优化代码
This commit is contained in:
@@ -34,11 +34,11 @@ class ApiAuth {
|
||||
} catch (TokenExpiredException $e) {
|
||||
$this->data['msg'] = $e->getMessage();
|
||||
$this->data['code'] = 2001;
|
||||
return json($this->data)->code($this->data['code']);
|
||||
return json($this->data);
|
||||
} catch (JWTException $e) {
|
||||
$this->data['code'] = 2000;
|
||||
$this->data['msg'] = $e->getMessage();
|
||||
return json($this->data)->code($this->data['code']);
|
||||
return json($this->data);
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
|
||||
@@ -31,7 +31,7 @@ class Validate {
|
||||
$scene = strtolower($controller[0]) . $request->action();
|
||||
$validate = "app\\http\\validate\\" . ucfirst($controller[1]);
|
||||
//仅当验证器存在时 进行校验
|
||||
if (class_exists($validate) && (strtolower($controller[0]) == 'admin' && $request->isPost())) {
|
||||
if (class_exists($validate) && $request->isPost()) {
|
||||
$v = new $validate;
|
||||
//仅当存在验证场景才校验
|
||||
if ($v->hasScene($scene)) {
|
||||
|
||||
Reference in New Issue
Block a user