fix(claim): 领取页展示游戏角色名,并说明乐玩免扫码场景
持久化 affiliate_dash roleName/gameChannel;免扫码授权时明确提示,有绑定链接时提交前仍可显示二维码。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -224,6 +224,7 @@ async function submitAffiliateDashClaimUid(
|
||||
orderNo: flow.orderNo,
|
||||
gameAccount: expectedUid,
|
||||
})
|
||||
const alreadyBound = Boolean(bindResult.bound)
|
||||
const nextFlow = {
|
||||
...flow,
|
||||
bindUuid: bindResult.bindUuid,
|
||||
@@ -231,10 +232,13 @@ async function submitAffiliateDashClaimUid(
|
||||
qrUrl: bindResult.qrUrl,
|
||||
gameAccount: expectedUid,
|
||||
expectedGameAccount: expectedUid,
|
||||
// 重新绑定:清空旧绑定状态,等待用户用新账号扫码完成新绑定。
|
||||
bound: false,
|
||||
boundAccount: '',
|
||||
gameChannel: '',
|
||||
// 乐玩「已授权免扫码」会直接 bound=true;否则清空等待扫码。
|
||||
bound: alreadyBound,
|
||||
boundAccount: alreadyBound
|
||||
? String(bindResult.gameAccount || expectedUid || '').trim()
|
||||
: '',
|
||||
roleName: alreadyBound ? String(bindResult.roleName || '').trim() : '',
|
||||
gameChannel: alreadyBound ? String(bindResult.gameChannel || '').trim() : '',
|
||||
bindMismatch: false,
|
||||
}
|
||||
|
||||
@@ -516,6 +520,7 @@ function clearAffiliateDashBindSnapshot(
|
||||
expectedGameAccount: gameAccount || flow.expectedGameAccount,
|
||||
bound: false,
|
||||
boundAccount: '',
|
||||
roleName: '',
|
||||
gameChannel: '',
|
||||
bindMismatch: false,
|
||||
}
|
||||
@@ -570,7 +575,12 @@ async function refreshAffiliateDashBindState(task: TaskRow): Promise<TaskRow | n
|
||||
expectedGameAccount: expectedGameAccount || flow.expectedGameAccount,
|
||||
bound: result.bound,
|
||||
boundAccount,
|
||||
gameChannel: result.bound ? result.gameChannel || flow.gameChannel : '',
|
||||
roleName: result.bound
|
||||
? String(result.roleName || flow.roleName || '').trim()
|
||||
: flow.roleName,
|
||||
gameChannel: result.bound
|
||||
? String(result.gameChannel || flow.gameChannel || '').trim()
|
||||
: flow.gameChannel,
|
||||
bindMismatch: Boolean(result.mismatch) || localMismatch,
|
||||
}
|
||||
const now = nowIso()
|
||||
|
||||
@@ -324,6 +324,8 @@ export type AffiliateDashFlow = {
|
||||
/** 是否已在 affiliate-dash 侧完成绑定(bind-result.bound) */
|
||||
bound: boolean
|
||||
boundAccount: string
|
||||
/** 绑定角色昵称(乐玩/DLC 返回) */
|
||||
roleName: string
|
||||
gameChannel: string
|
||||
submitStatus: string
|
||||
consumeStatus: string
|
||||
@@ -337,6 +339,10 @@ export function normalizeAffiliateDashFlow(value: unknown): AffiliateDashFlow {
|
||||
const source =
|
||||
value && typeof value === 'object' && !Array.isArray(value) ? (value as JsonObject) : {}
|
||||
|
||||
const raw = source.raw && typeof source.raw === 'object' ? (source.raw as JsonObject) : null
|
||||
const rawResult =
|
||||
raw && raw.result && typeof raw.result === 'object' ? (raw.result as JsonObject) : null
|
||||
|
||||
return {
|
||||
flowType: 'affiliate_dash',
|
||||
sku: String(source.sku || '').trim(),
|
||||
@@ -358,11 +364,16 @@ export function normalizeAffiliateDashFlow(value: unknown): AffiliateDashFlow {
|
||||
bindMismatch: Boolean(source.bindMismatch),
|
||||
bound: Boolean(source.bound),
|
||||
boundAccount: String(source.boundAccount || '').trim(),
|
||||
gameChannel: String(source.gameChannel || '').trim(),
|
||||
roleName: String(
|
||||
source.roleName || rawResult?.role_name || raw?.role_name || '',
|
||||
).trim(),
|
||||
gameChannel: String(
|
||||
source.gameChannel || rawResult?.game_channel || raw?.game_channel || '',
|
||||
).trim(),
|
||||
submitStatus: String(source.submitStatus || '').trim(),
|
||||
consumeStatus: String(source.consumeStatus || 'pending').trim(),
|
||||
lastSyncedAt: source.lastSyncedAt || null,
|
||||
raw: source.raw && typeof source.raw === 'object' ? source.raw : null,
|
||||
raw,
|
||||
mock:
|
||||
source.mock && typeof source.mock === 'object'
|
||||
? {
|
||||
|
||||
Reference in New Issue
Block a user