feat(douyu): 增加账号角色异常状态

This commit is contained in:
yml
2026-11-19 16:19:00 +08:00
parent dd48175b4a
commit 9d6403646a
5 changed files with 105 additions and 14 deletions
+1
View File
@@ -7,6 +7,7 @@ export type DouyuCollabStatus =
| 'scripted'
| 'done'
| 'points_error'
| 'role_error'
| 'failed'
| 'void';
+11 -12
View File
@@ -108,6 +108,7 @@ const STATUS_META: Record<DouyuCollabStatus, { label: string; color: string }> =
scripted: { label: '已上脚本', color: 'purple' },
done: { label: '抢购成功', color: 'green' },
points_error: { label: '积分异常', color: 'orange' },
role_error: { label: '账号角色异常', color: 'volcano' },
failed: { label: '抢购失败', color: 'red' },
void: { label: '已作废', color: 'default' },
};
@@ -119,6 +120,7 @@ const STATUS_ORDER: DouyuCollabStatus[] = [
'scripted',
'done',
'points_error',
'role_error',
'failed',
'void',
];
@@ -462,7 +464,9 @@ export default function DouyuCollabPage() {
const targetIndex = FLOW_ORDER.indexOf(statusValue);
if (targetIndex < 0) return false;
return selectedOrders.some((row) => {
if (row.status === 'failed' || row.status === 'void') return true;
if (row.status === 'failed' || row.status === 'role_error' || row.status === 'void') {
return true;
}
const currentIndex = FLOW_ORDER.indexOf(row.status);
return currentIndex >= 0 && targetIndex < currentIndex;
});
@@ -834,10 +838,14 @@ export default function DouyuCollabPage() {
const currentIndex = FLOW_ORDER.indexOf(statusTarget.status);
const targetIndex = FLOW_ORDER.indexOf(statusValue);
const restoringVoid = statusTarget.status === 'void';
const restoringError =
statusTarget.status === 'failed' || statusTarget.status === 'role_error';
await douyuCollabApi.setStatus(statusTarget.id, {
status: statusValue,
reason: statusReason,
rollback: targetIndex >= 0 && currentIndex >= 0 && targetIndex < currentIndex,
rollback:
restoringError ||
(targetIndex >= 0 && currentIndex >= 0 && targetIndex < currentIndex),
expected_version: statusTarget.version,
});
message.success(restoringVoid ? '已取消作废并恢复状态' : '状态已更新');
@@ -1470,15 +1478,6 @@ export default function DouyuCollabPage() {
</Card>
</Col>
))}
<Col flex="1 1 92px">
<Card size="small" style={{ height: '100%' }}>
<Statistic
title="账号缺失"
value={summary.account_missing}
styles={{ content: { color: '#cf1322' } }}
/>
</Card>
</Col>
<Col flex="1 1 92px">
<Card
size="small"
@@ -2065,7 +2064,7 @@ export default function DouyuCollabPage() {
checked={batchStatusRollback}
onChange={(event) => setBatchStatusRollback(event.target.checked)}
>
回退(目标比当前状态靠前,或从「抢购失败 / 已作废」回到流程时必须勾选)
回退(目标比当前状态靠前,或从「抢购失败 / 账号角色异常 / 已作废」回到流程时必须勾选)
</Checkbox>
{batchRollbackRequired && !batchStatusRollback && (
<Alert
@@ -51,6 +51,7 @@ const COLLAB_STATUS_LABELS: Record<string, string> = {
scripted: '已上脚本',
done: '抢购成功',
points_error: '积分异常',
role_error: '账号角色异常',
failed: '抢购失败',
void: '已作废',
};