feat(login): 登录任务展示触发方式与执行人

- 后端按批次/账号关联 LoginAttempt,返回 trigger_source/category/操作人
- 登录任务页增加“触发方式”“执行人”列
- 区分自动化/人工、首次登录/高价值重登/普通重登/账号检测
- 补充登录任务来源回归测试
This commit is contained in:
yml
2026-11-24 15:58:18 +08:00
parent 8449b726a3
commit ce971e2b36
5 changed files with 114 additions and 2 deletions
+3
View File
@@ -486,6 +486,9 @@ export interface LoginTaskItem {
cookie: string;
message: string;
created_by: number;
created_by_username: string;
trigger_source: string;
category: string;
created_at: string | null;
finished_at: string | null;
}
+40
View File
@@ -43,6 +43,31 @@ const STATUS_LABELS: Record<string, string> = {
account_auth_unknown: '认证状态未知',
};
const TRIGGER_SOURCE_LABELS: Record<string, string> = {
automation: '自动化',
manual: '人工',
};
const LOGIN_CATEGORY_LABELS: Record<string, string> = {
onboarding: '首次登录',
relogin_high_value: '高价值重登',
relogin_ordinary: '普通重登',
manual: '人工登录',
account_check: '账号检测',
};
function loginSourceLabel(task: LoginTaskItem) {
const source = TRIGGER_SOURCE_LABELS[task.trigger_source] || '未知';
const category = LOGIN_CATEGORY_LABELS[task.category] || '';
return category ? `${source} · ${category}` : source;
}
function loginSourceColor(task: LoginTaskItem) {
if (task.trigger_source === 'automation') return 'blue';
if (task.trigger_source === 'manual') return 'green';
return 'default';
}
const ACCOUNT_STATUS_LABELS: Record<string, string> = {
imported: '未登录',
active: '正常',
@@ -590,6 +615,21 @@ export default function LoginTasksPage() {
width: 130,
render: (name: string) => name || <Text type="secondary">未分配</Text>,
},
{
title: '触发方式',
dataIndex: 'trigger_source',
width: 170,
render: (_: string, record: LoginTaskItem) => (
<Tag color={loginSourceColor(record)}>{loginSourceLabel(record)}</Tag>
),
},
{
title: '执行人',
dataIndex: 'created_by_username',
width: 110,
render: (name: string, record: LoginTaskItem) =>
name || `#${record.created_by}`,
},
{
title: 'CK 状态',
dataIndex: 'ck_check_status',