1.优化getPlayerInfo接口

This commit is contained in:
2026-05-13 10:15:49 +08:00
parent 6a1fd639a4
commit 52b5ccb8e4
4 changed files with 85 additions and 7 deletions

View File

@@ -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) {
// 单次 Redistoken → 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);
}