update api key
This commit is contained in:
@@ -94,6 +94,13 @@ class AuthMiddleware implements MiddlewareInterface
|
||||
])->withStatus(401);
|
||||
}
|
||||
|
||||
if (!$api_key->enabled) {
|
||||
return $this->response->json([
|
||||
'code' => 403,
|
||||
'message' => '该 API Key 已被禁用',
|
||||
])->withStatus(403);
|
||||
}
|
||||
|
||||
$user = $api_key->user;
|
||||
|
||||
if (!$user || $user->status !== 1) {
|
||||
|
||||
@@ -86,7 +86,6 @@ class ApiKey extends Model
|
||||
|
||||
return static::query()
|
||||
->where('key_hash', $hash)
|
||||
->where('enabled', true)
|
||||
->where(function ($query): void {
|
||||
$query->whereNull('expires_at')
|
||||
->orWhere('expires_at', '>', \Carbon\Carbon::now());
|
||||
|
||||
Reference in New Issue
Block a user