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',