优化(登录任务): 逐账号日志改为全量采集,并收口不可重试失败

- loguru sink 按线程采集 core/ 登录步骤日志(代理、极验、邮箱取码等)
- 单任务最多 300 条,溢出优先丢 DEBUG,消息截断 1200 字
- 日志改用独立短事务写入,避免与登录事务互相等锁
- 日志弹窗显示级别/时间/模块,支持复制全部
- 必须绑定手机号改为不可重试终态,不再空转 20 轮
- 邮箱验证码超时最多重试 2 次,避免单账号拖 20 分钟
This commit is contained in:
yml
2026-11-25 17:10:46 +08:00
parent c348d7fa2b
commit dcd11cb8b1
6 changed files with 408 additions and 83 deletions
+57 -23
View File
@@ -1164,37 +1164,71 @@ export default function LoginTasksPage() {
<Modal
title={logTask ? `登录日志 · ${logTask.account_username}` : '登录日志'}
open={Boolean(logTask)}
footer={null}
width={760}
width={860}
onCancel={() => setLogTask(null)}
footer={[
<Button
key="copy"
disabled={logItems.length === 0}
onClick={() => {
const text = logItems
.map((item) => `${item.at ? formatTime(item.at) : ''} [${item.level || 'info'}] ${item.message}`)
.join('\n');
void navigator.clipboard
?.writeText(text)
.then(() => message.success(`已复制 ${logItems.length} 条日志`))
.catch(() => message.error('复制失败,请手动选择文本'));
}}
>
复制全部
</Button>,
<Button key="close" type="primary" onClick={() => setLogTask(null)}>
关闭
</Button>,
]}
>
{logsLoading ? (
<div style={{ minHeight: 120, display: 'grid', placeItems: 'center' }}>
<Spin />
</div>
) : logItems.length === 0 ? (
<Text type="secondary">暂无日志;任务完成后会写入本次登录尝试的日志。</Text>
<Text type="secondary">
暂无日志。逐账号日志在本次登录尝试结束后写入;旧的登录任务不会再补。
</Text>
) : (
<div style={{ maxHeight: '62vh', overflow: 'auto', display: 'grid', gap: 8 }}>
{logItems.map((item, index) => (
<div
key={`${item.at || ''}-${index}`}
style={{
padding: '8px 10px',
border: `1px solid ${token.colorBorderSecondary}`,
borderRadius: 6,
}}
>
<Space size={6} style={{ marginBottom: 4 }}>
<Tag color={item.level === 'error' ? 'red' : item.level === 'warning' ? 'orange' : item.level === 'success' ? 'green' : 'blue'}>
{item.level || 'info'}
</Tag>
{item.at ? <Text type="secondary" style={{ fontSize: 12 }}>{formatTime(item.at)}</Text> : null}
</Space>
<div style={{ whiteSpace: 'pre-wrap', wordBreak: 'break-word' }}>{item.message}</div>
</div>
))}
</div>
<>
<Text type="secondary" style={{ fontSize: 12 }}>
共 {logItems.length} 条,包含代理预检、极验、登录步骤和邮箱取码等完整过程。
</Text>
<div style={{ maxHeight: '58vh', overflow: 'auto', display: 'grid', gap: 6, marginTop: 8 }}>
{logItems.map((item, index) => (
<div
key={`${item.at || ''}-${index}`}
style={{
padding: '6px 10px',
border: `1px solid ${token.colorBorderSecondary}`,
borderRadius: 6,
background: item.level === 'error' ? token.colorErrorBg : undefined,
}}
>
<Space size={6} style={{ marginBottom: 2 }}>
<Tag color={item.level === 'error' ? 'red' : item.level === 'warning' ? 'orange' : item.level === 'success' ? 'green' : item.level === 'debug' ? 'default' : 'blue'}>
{item.level || 'info'}
</Tag>
{item.at ? (
<Text type="secondary" style={{ fontSize: 12 }}>{formatTime(item.at)}</Text>
) : null}
{item.module ? (
<Text type="secondary" style={{ fontSize: 12 }}>{item.module}</Text>
) : null}
</Space>
<div style={{ whiteSpace: 'pre-wrap', wordBreak: 'break-word', fontFamily: 'ui-monospace, SFMono-Regular, Menlo, monospace', fontSize: 12 }}>
{item.message}
</div>
</div>
))}
</div>
</>
)}
</Modal>
</div>