= 3) { CacheService::clearToken($token); throw new AuthException('登陆过期!', 410001); } try { [$adminInfo, $type] = SystemBadmin::parseToken($token); CacheService::setTokenBucket($cacheToken['token'], $cacheToken, $cacheToken['exp']); } catch (ExpiredException $e) { list($headb64, $bodyb64, $cryptob64) = explode('.', $token); $payload = JWT::jsonDecode(JWT::urlsafeB64Decode($bodyb64)); $type = $payload->jti->type; $adminInfo = SystemBadmin::where('id', $payload->jti->id)->find(); if (!$adminInfo) { CacheService::clearToken($token); throw new AuthException('登陆过期!', 410001); } if (isset($cacheToken['max'])) { $cacheToken['max'] = bcadd($cacheToken['max'], 1, 0); } else { $cacheToken['max'] = 1; } CacheService::setTokenBucket($cacheToken['token'], $cacheToken, $cacheToken['exp']); } catch (\Throwable $e) { CacheService::clearToken($token); throw new AuthException('登陆过期!', 410001); } if (!isset($adminInfo) || !$adminInfo || !$adminInfo->id || $type != "badmin") { CacheService::clearToken($token); throw new AuthException('登录状态异常,请重新登录!', 410002); } $adminInfo->type = $type; return $adminInfo->toArray(); } }