修改exception

This commit is contained in:
yanwnewu
2018-11-30 18:29:35 +08:00
parent 70889deb73
commit 3c3c0471e1
3 changed files with 7 additions and 47 deletions

View File

@@ -6,7 +6,7 @@
*/
namespace app\admin\request;
use think\exception\HttpException;
use think\exception\HttpResponseException;
use think\Request;
abstract class FormRequest extends Request
@@ -20,7 +20,11 @@ abstract class FormRequest extends Request
parent::__construct();
if ($this->withServer($_SERVER)->isAjax(true) && $err = $this->validate()) {
throw new HttpException(0, $err);
throw new HttpResponseException(json([
'code' => 0,
'msg' => $err,
'wait' => 3,
]));
}
}
}