移除 affiliate-dash 不更换二维码测试
This commit is contained in:
@@ -372,10 +372,7 @@ export async function submitClaimUid(
|
||||
}
|
||||
|
||||
if (executorKey === 'affiliate_dash') {
|
||||
updatedTask =
|
||||
(await bindAffiliateDashClaimForTask(updatedTask, expectedUid, {
|
||||
keepExistingBindOnUidUpdate: shouldKeepAffiliateDashBindOnUidUpdate(),
|
||||
})) || updatedTask
|
||||
updatedTask = (await bindAffiliateDashClaimForTask(updatedTask, expectedUid)) || updatedTask
|
||||
}
|
||||
|
||||
return getKuaishouCloudClaimDetail(token)
|
||||
@@ -527,11 +524,7 @@ export async function submitAffiliateDashClaim(
|
||||
* 提交 UID 后触发 affiliate-dash 绑定(bind),把 bind_uuid / 二维码写回上下文,
|
||||
* task → waiting_binding(link_generated → waiting_binding 合法)。
|
||||
*/
|
||||
async function bindAffiliateDashClaimForTask(
|
||||
task: TaskRow,
|
||||
gameAccount: string,
|
||||
options: { keepExistingBindOnUidUpdate?: boolean } = {},
|
||||
) {
|
||||
async function bindAffiliateDashClaimForTask(task: TaskRow, gameAccount: string) {
|
||||
const taskContext = parseTaskContextValue(task)
|
||||
const flow = normalizeAffiliateDashFlow(taskContext.affiliateDash)
|
||||
if (!flow.orderNo || !gameAccount) {
|
||||
@@ -539,42 +532,6 @@ async function bindAffiliateDashClaimForTask(
|
||||
}
|
||||
|
||||
const now = nowIso()
|
||||
const shouldReuseExistingBind = Boolean(
|
||||
options.keepExistingBindOnUidUpdate &&
|
||||
flow.bindUuid &&
|
||||
flow.bound &&
|
||||
flow.boundAccount &&
|
||||
normalizeUid(flow.boundAccount) === normalizeUid(gameAccount),
|
||||
)
|
||||
if (shouldReuseExistingBind) {
|
||||
const nextFlow = {
|
||||
...flow,
|
||||
gameAccount,
|
||||
expectedGameAccount: gameAccount,
|
||||
bindMismatch: false,
|
||||
}
|
||||
const updatedTask = await updateTask(task.id, {
|
||||
task_status: TASK_STATUS.WAITING_BINDING,
|
||||
context_json: JSON.stringify({
|
||||
...taskContext,
|
||||
affiliateDash: nextFlow,
|
||||
}),
|
||||
updated_at: now,
|
||||
})
|
||||
await createTaskEvent(
|
||||
task.id,
|
||||
'affiliate_dash_bind_reused_for_uid_update',
|
||||
{
|
||||
orderNo: flow.orderNo,
|
||||
bindUuid: flow.bindUuid,
|
||||
gameAccount,
|
||||
boundAccount: flow.boundAccount,
|
||||
},
|
||||
now,
|
||||
)
|
||||
return updatedTask || task
|
||||
}
|
||||
|
||||
const bindResult = await bindAffiliateDashDelivery({
|
||||
orderNo: flow.orderNo,
|
||||
gameAccount,
|
||||
@@ -667,11 +624,6 @@ async function refreshAffiliateDashBindState(task: TaskRow): Promise<TaskRow | n
|
||||
}
|
||||
}
|
||||
|
||||
function shouldKeepAffiliateDashBindOnUidUpdate() {
|
||||
const value = String(process.env.AFFILIATE_DASH_KEEP_BIND_ON_UID_UPDATE || '').trim().toLowerCase()
|
||||
return value === '1' || value === 'true' || value === 'yes' || value === 'on'
|
||||
}
|
||||
|
||||
function normalizeUid(value: unknown) {
|
||||
return String(value || '')
|
||||
.trim()
|
||||
|
||||
Reference in New Issue
Block a user