update: rollback token cache

This commit is contained in:
tokumeikoi
2022-04-11 10:19:36 +08:00
parent e82f28b670
commit 27271e3ffb
4 changed files with 2 additions and 62 deletions

View File

@ -19,7 +19,7 @@ class Client
public function handle($request, Closure $next)
{
$token = $request->input('token');
if (empty($token) || $this->tokenNotInCache($token)) {
if (empty($token)) {
abort(403, 'token is null');
}
$user = User::where('token', $token)->first();
@ -29,12 +29,4 @@ class Client
$request->user = $user;
return $next($request);
}
private function tokenNotInCache($token)
{
// schedule init complete?
if (!Cache::get(CacheKey::get('SCHEDULE_LAST_CHECK_AT', null))) return true;
if (Cache::get(CacheKey::get('SUBSCRIBE_TOKEN', $token))) return false;
return true;
}
}