diff --git a/apps/backend/src/services/claim/kuaishou-cloud-claim-service.ts b/apps/backend/src/services/claim/kuaishou-cloud-claim-service.ts index 295c2231..834fefe2 100644 --- a/apps/backend/src/services/claim/kuaishou-cloud-claim-service.ts +++ b/apps/backend/src/services/claim/kuaishou-cloud-claim-service.ts @@ -415,6 +415,31 @@ export async function submitAffiliateDashClaim( const now = nowIso() const isMock = Boolean(flow.mock?.enabled) + + // 强制校验:绑定返回的游戏账号与第一步填写 UID 不一致时禁止提交(防止 uid 输错), + // 不依赖平台 mismatch 字段。拉取绑定结果失败时不阻塞(平台提交时仍会校验)。 + if (!isMock && flow.bindUuid) { + let mismatch = false + try { + const bindResult = await getAffiliateDashBindResult({ + orderNo: flow.orderNo, + bindUuid, + }) + const boundAccount = bindResult.gameAccount + mismatch = + Boolean(bindResult.mismatch) || + Boolean(boundAccount && normalizeUid(boundAccount) !== normalizeUid(gameAccount)) + } catch { + // 拉取失败:保持放行 + } + if (mismatch) { + throw createHttpError('绑定账号与填写 UID 不一致,请确认后重新绑定', { + statusCode: 409, + errorCode: 'affiliate_dash_bind_mismatch', + }) + } + } + const result = isMock ? { status: 'delivered', @@ -490,6 +515,7 @@ async function bindAffiliateDashClaimForTask(task: TaskRow, gameAccount: string) bindUrl: bindResult.bindUrl, qrUrl: bindResult.qrUrl, gameAccount, + expectedGameAccount: gameAccount, } const updatedTask = await updateTask(task.id, { @@ -534,12 +560,20 @@ async function refreshAffiliateDashBindState(task: TaskRow): Promise + ) : bindMismatch ? ( + ) : (