From 05fa65840086fe0687012be6dac5574788a67f3f Mon Sep 17 00:00:00 2001 From: yml Date: Tue, 24 Nov 2026 22:08:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D(=E6=96=97=E9=B1=BC=E9=A2=86?= =?UTF-8?q?=E5=8F=96):=20=E8=B4=A6=E5=8F=B7=E5=88=86=E9=85=8D=E5=86=B7?= =?UTF-8?q?=E5=8D=B4=E4=B8=8D=E5=86=8D=E8=AF=AF=E6=8A=A5=E8=A7=92=E8=89=B2?= =?UTF-8?q?=E7=BB=91=E5=AE=9A=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 尚未开始绑定、只是选号遇到账号换绑冷却时归为 preparing - 只有绑定任务/二维码/待确认/已确认或 bindingStatus=failed 才归为 failed - 补充分配冷却状态测试 --- .../douyu-fulfillment/douyu-fulfillment-service.ts | 11 ++++++++++- .../douyu-fulfillment/douyu-fulfillment.test.ts | 14 ++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/apps/backend/src/services/douyu-fulfillment/douyu-fulfillment-service.ts b/apps/backend/src/services/douyu-fulfillment/douyu-fulfillment-service.ts index daa8a19b..adc33beb 100644 --- a/apps/backend/src/services/douyu-fulfillment/douyu-fulfillment-service.ts +++ b/apps/backend/src/services/douyu-fulfillment/douyu-fulfillment-service.ts @@ -461,7 +461,16 @@ export function statusForLive(live: LiveBindingState): string { if (live.customerProfileReset === true) return 'waiting_profile' if (live.executionStatus === 'completed') return 'completed' if (live.executionStatus === 'cancelled') return 'cancelled' - if (live.bindingStatus === 'failed' || BINDING_FAILURE_ISSUES.has(live.issueCode)) { + const bindingStarted = + live.bindingStatus !== 'not_started' || + Boolean(live.bindTaskId) || + Boolean(live.qrUrl) || + live.bindReadyForConfirm || + live.bindConfirmed + if ( + live.bindingStatus === 'failed' || + (BINDING_FAILURE_ISSUES.has(live.issueCode) && bindingStarted) + ) { return 'failed' } if (live.executionStatus === 'manual_required') return 'manual_required' diff --git a/apps/backend/src/services/douyu-fulfillment/douyu-fulfillment.test.ts b/apps/backend/src/services/douyu-fulfillment/douyu-fulfillment.test.ts index 0b460967..27a6a16f 100644 --- a/apps/backend/src/services/douyu-fulfillment/douyu-fulfillment.test.ts +++ b/apps/backend/src/services/douyu-fulfillment/douyu-fulfillment.test.ts @@ -43,6 +43,20 @@ test('斗鱼客户资料角色名不一致时禁止确认', () => { assert.equal(result.roleMatched, false) }) +test('账号换绑冷却但尚未开始绑定,不应显示角色绑定失败', () => { + const status = statusForLive({ + executionStatus: 'ready', + bindingStatus: 'not_started', + issueCode: 'account_role_cooldown', + bindTaskId: null, + qrUrl: '', + bindReadyForConfirm: false, + bindConfirmed: false, + accountReady: false, + } as never) + assert.equal(status, 'preparing') +}) + test('绑定失败优先于旧角色确认标记', () => { const status = statusForLive({ executionStatus: 'manual_required',