feat: 在 JwtAuthMiddleware 中添加用户状态检查,处理封禁用户的请求

This commit is contained in:
lingling 2025-03-15 12:22:34 +08:00
parent 248abb51c2
commit dd329c6ee0
1 changed files with 4 additions and 0 deletions

View File

@ -74,6 +74,10 @@ class JwtAuthMiddleware implements MiddlewareInterface
if (false !== strstr($controller->name, 'admin') || false !== strstr($controller->name, 'generalization')) {
return response('', 401, ['error' => '无权限']);
}
$user=User::find($decoded['id']);
if($user->status==0){
return response('',401,['error' => '用户封禁']);
}
break;
case 'generalization':