diff --git a/src/features/player/entry-gate.tsx b/src/features/player/entry-gate.tsx index 28d74bb..d23a806 100644 --- a/src/features/player/entry-gate.tsx +++ b/src/features/player/entry-gate.tsx @@ -17,7 +17,7 @@ import { useTranslation } from "react-i18next"; import { getPlayerMe, getPlayerPing } from "@/api/player"; import { LanguageSwitcher } from "@/components/language-switcher"; -import { Button } from "@/components/ui/button"; +import { Button, buttonVariants } from "@/components/ui/button"; import { cn } from "@/lib/utils"; import { usePlayerSessionStore } from "@/stores/player-session-store"; import { LotteryApiBizError } from "@/types/api/errors"; @@ -25,6 +25,17 @@ import { LotteryApiBizError } from "@/types/api/errors"; const RETRY_ATTEMPTS = 3; const RETRY_DELAY_MS = 2000; +const MAIN_SITE_URL = process.env.NEXT_PUBLIC_MAIN_SITE_URL?.trim() ?? ""; + +/** `/api/player/me` 等业务信封业务码 — 玩家 SSO 段 8001–8005(与后端 ErrorCode 一致) */ +const PLAYER_BIZ_DETAIL: Partial> = { + 8001: "errors.player8001", + 8002: "errors.player8002", + 8003: "errors.player8003", + 8004: "errors.player8004", + 8005: "errors.player8005", +}; + type EntryStepId = "token" | "account" | "hall"; type EntryStepStatus = "pending" | "in-progress" | "done" | "error"; @@ -160,12 +171,7 @@ export function EntryGate() { const details: FailureRow[] = []; if (typeof err.code === "number") { - const keyByCode: Partial> = { - 401: "errors.http401", - 403: "errors.http403", - 404: "errors.http404", - }; - const dk = keyByCode[err.code]; + const dk = PLAYER_BIZ_DETAIL[err.code]; details.push({ code: String(err.code), ...(dk ? { detailKey: dk } : {}), @@ -373,15 +379,27 @@ export function EntryGate() { ) : null} - +
+ + {MAIN_SITE_URL !== "" ? ( + + {t("failure.backToMainSite")} + + ) : null} +
) : null} diff --git a/src/i18n/locales/en/entry.json b/src/i18n/locales/en/entry.json index 0711ea8..2cc4f53 100644 --- a/src/i18n/locales/en/entry.json +++ b/src/i18n/locales/en/entry.json @@ -37,7 +37,8 @@ "check": "Check", "reason": "Reason" }, - "reenter": "Re-enter" + "reenter": "Re-enter", + "backToMainSite": "Back to main site" }, "success": { "title": "Authorization successful!", @@ -60,6 +61,11 @@ "tryLater": "Please try again later", "http401": "Token is invalid or expired", "http403": "Account has been blocked", - "http404": "Account not found in the system" + "http404": "Account not found in the system", + "player8001": "Missing or invalid Authorization", + "player8002": "Token invalid, expired, malformed, or exceeding the allowed time window (e.g. >5 min)", + "player8003": "Player not registered (dev token only)", + "player8004": "SSO not configured on lottery server", + "player8005": "Account suspended or unavailable" } } diff --git a/src/i18n/locales/ne/entry.json b/src/i18n/locales/ne/entry.json index ad7abec..5501448 100644 --- a/src/i18n/locales/ne/entry.json +++ b/src/i18n/locales/ne/entry.json @@ -37,7 +37,8 @@ "check": "जाँच", "reason": "कारण" }, - "reenter": "पुन: प्रवेश" + "reenter": "पुन: प्रवेश", + "backToMainSite": "मुख्य साइटमा फर्कनुहोस्" }, "success": { "title": "प्राधिकरण सफल!", @@ -60,6 +61,11 @@ "tryLater": "कृपया पछि प्रयास गर्नुहोस्", "http401": "टोकन अमान्य वा म्याद सकियो", "http403": "खाता रोकिएको छ", - "http404": "प्रणालीमा खाता फेला परेन" + "http404": "प्रणालीमा खाता फेला परेन", + "player8001": "अनुमति हेडर हराइरहेको छ वा अमान्य छ", + "player8002": "टोकन अमान्य, म्याद सकिएको, फिल्ड हराइएको वा समय सीमा मन नपर्ने", + "player8003": "खाता दर्ता छैन (विकास टोकन मात्र)", + "player8004": "लटरी सर्भरमा SSO कन्फिगर छैन", + "player8005": "खाता निलम्बन वा अनुपलब्ध" } } diff --git a/src/i18n/locales/zh/entry.json b/src/i18n/locales/zh/entry.json index 2b154db..5b12d43 100644 --- a/src/i18n/locales/zh/entry.json +++ b/src/i18n/locales/zh/entry.json @@ -37,7 +37,8 @@ "check": "检查项", "reason": "原因" }, - "reenter": "重新进入" + "reenter": "重新进入", + "backToMainSite": "返回主站" }, "success": { "title": "授权成功!", @@ -60,6 +61,11 @@ "tryLater": "请稍后再试", "http401": "令牌无效或已过期", "http403": "账号已被封禁", - "http404": "系统中未找到该账号" + "http404": "系统中未找到该账号", + "player8001": "缺少或非法的授权凭证", + "player8002": "Token 无效、已过期或不符合时效(如有效窗超过 5 分钟/缺少必填字段)", + "player8003": "玩家未注册(仅开发 Token)", + "player8004": "彩票服务端未配置 SSO", + "player8005": "账号已冻结或不可用" } }