From 815728ab084565d1d58fc1b2b9f014e33e30998f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Sat, 3 Oct 2026 19:15:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=89=8D=E7=AB=AF=EF=BC=9A=E6=B8=B8=E7=8E=A9?= =?UTF-8?q?=E4=B8=8A=E6=8A=A5=E5=A4=8D=E7=94=A8=E5=90=8E=E5=8F=B0=E8=AF=B7?= =?UTF-8?q?=E6=B1=82=E7=9A=84=E9=89=B4=E6=9D=83=E9=99=8D=E7=BA=A7=E7=AD=96?= =?UTF-8?q?=E7=95=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - gameDistributionClient.ts:删除与 BACKGROUND_AUTH_REQUEST_OPTIONS 逐字重复的 PLAY_REPORT_REQUEST_OPTIONS,改为直接复用该常量,避免两处 local/background 鉴权语义日后漂移 --- src/services/gameDistributionClient.ts | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/services/gameDistributionClient.ts b/src/services/gameDistributionClient.ts index ebbbcc10e..36e902ce3 100644 --- a/src/services/gameDistributionClient.ts +++ b/src/services/gameDistributionClient.ts @@ -16,6 +16,7 @@ import type { } from '../../packages/shared/src/contracts/gameDistribution'; import { type ApiRequestOptions, + BACKGROUND_AUTH_REQUEST_OPTIONS, requestJson as requestApiJson, } from './apiClient'; import { getGamePlayClientId } from './gamePlayClientId'; @@ -70,14 +71,8 @@ const PUBLIC_GAME_REQUEST_OPTIONS: ApiRequestOptions = { /** * 游玩上报是后台尽力而为的请求:带上已登录 bearer(后端据此按 userId 去重),但即使遇到 401 - * 也不刷新会话、不改动全局登录态,避免一次计数把整站登录态带进刷新或登出流程。 + * 也不刷新会话、不改动全局登录态——直接复用后台请求已有的同一份鉴权降级策略。 */ -const PLAY_REPORT_REQUEST_OPTIONS: ApiRequestOptions = { - authImpact: 'local', - skipRefresh: true, - notifyAuthStateChange: false, - clearAuthOnUnauthorized: false, -}; async function requestJson( path: string, @@ -197,7 +192,7 @@ export function recordGamePlay(gameId: string) { body: JSON.stringify({ clientId: getGamePlayClientId() }), }, '游玩上报失败', - PLAY_REPORT_REQUEST_OPTIONS, + BACKGROUND_AUTH_REQUEST_OPTIONS, ); }