1.优化getPlayerInfo接口
This commit is contained in:
@@ -47,8 +47,9 @@ class AuthTokenMiddleware implements MiddlewareInterface
|
||||
throw new ApiException('auth-token invalid', ReturnCode::TOKEN_INVALID);
|
||||
}
|
||||
|
||||
$currentToken = AuthTokenCache::getTokenByAgentId($agentId);
|
||||
if ($currentToken === null || $currentToken !== $token) {
|
||||
// 单次 Redis:token → agent_id,与 JWT 内 agent_id 一致即有效(减少一次按 agent 取当前 token 的往返)
|
||||
$agentIdFromStore = AuthTokenCache::getAgentIdByToken($token);
|
||||
if ($agentIdFromStore === null || $agentIdFromStore !== $agentId) {
|
||||
throw new ApiException('auth-token invalid or expired', ReturnCode::TOKEN_INVALID);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user