修复(斗鱼领取): 账号分配冷却不再误报角色绑定失败
- 尚未开始绑定、只是选号遇到账号换绑冷却时归为 preparing - 只有绑定任务/二维码/待确认/已确认或 bindingStatus=failed 才归为 failed - 补充分配冷却状态测试
This commit is contained in:
@@ -461,7 +461,16 @@ export function statusForLive(live: LiveBindingState): string {
|
|||||||
if (live.customerProfileReset === true) return 'waiting_profile'
|
if (live.customerProfileReset === true) return 'waiting_profile'
|
||||||
if (live.executionStatus === 'completed') return 'completed'
|
if (live.executionStatus === 'completed') return 'completed'
|
||||||
if (live.executionStatus === 'cancelled') return 'cancelled'
|
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'
|
return 'failed'
|
||||||
}
|
}
|
||||||
if (live.executionStatus === 'manual_required') return 'manual_required'
|
if (live.executionStatus === 'manual_required') return 'manual_required'
|
||||||
|
|||||||
@@ -43,6 +43,20 @@ test('斗鱼客户资料角色名不一致时禁止确认', () => {
|
|||||||
assert.equal(result.roleMatched, false)
|
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('绑定失败优先于旧角色确认标记', () => {
|
test('绑定失败优先于旧角色确认标记', () => {
|
||||||
const status = statusForLive({
|
const status = statusForLive({
|
||||||
executionStatus: 'manual_required',
|
executionStatus: 'manual_required',
|
||||||
|
|||||||
Reference in New Issue
Block a user