add _validateInvoked property to check validate method is invoked

This commit is contained in:
lichengyin 2015-10-26 10:07:36 +08:00
parent 960e308980
commit 1c3ae780d4

View File

@ -111,6 +111,7 @@ export default class extends think.controller.base {
* @return {} []
*/
validate(data) {
this._validateInvoked = true;
if(think.isEmpty(data)){
return true;
}
@ -134,7 +135,7 @@ export default class extends think.controller.base {
* @return {} []
*/
__after(){
if(think.isEmpty(this.rules)){
if(think.isEmpty(this.rules) || this._validateInvoked){
return;
}
let flag = this.validate(this.rules);