优化登录重试与配置清理
This commit is contained in:
@@ -2,7 +2,7 @@ import { useEffect, useState, useMemo, useCallback } from 'react';
|
||||
import {
|
||||
Table, Button, Select, message, Tag, Space, InputNumber, Tooltip, Popconfirm, theme,
|
||||
} from 'antd';
|
||||
import { PlayCircleOutlined, StopOutlined, FilterOutlined, ThunderboltOutlined, ReloadOutlined, DeleteOutlined, SwapOutlined } from '@ant-design/icons';
|
||||
import { PlayCircleOutlined, StopOutlined, FilterOutlined, ThunderboltOutlined, ReloadOutlined, DeleteOutlined } from '@ant-design/icons';
|
||||
import { accountApi, loginApi, type AccountItem, type LoginTaskItem } from '../api/modules';
|
||||
import RealtimeLogPanel from '../components/RealtimeLogPanel';
|
||||
import { usePermissions } from '../hooks/usePermissions';
|
||||
@@ -42,14 +42,9 @@ export default function LoginTasksPage() {
|
||||
const v = localStorage.getItem('login_concurrency');
|
||||
return v ? Math.max(1, Math.min(10, Number(v) || 3)) : 3;
|
||||
});
|
||||
const [maxProxyRetries, setMaxProxyRetries] = useState(() => {
|
||||
const v = localStorage.getItem('login_max_proxy_retries');
|
||||
return v ? Math.max(0, Number(v) || 0) : 0;
|
||||
});
|
||||
|
||||
// 值变化时自动持久化
|
||||
useEffect(() => { localStorage.setItem('login_concurrency', String(concurrency)); }, [concurrency]);
|
||||
useEffect(() => { localStorage.setItem('login_max_proxy_retries', String(maxProxyRetries)); }, [maxProxyRetries]);
|
||||
const [selectedRowKeys, setSelectedRowKeys] = useState<number[]>([]);
|
||||
const { logs, connected: wsConnected, connect: connectLogs } = useWebSocketLogs();
|
||||
const { can } = usePermissions();
|
||||
@@ -145,11 +140,7 @@ export default function LoginTasksPage() {
|
||||
try {
|
||||
const result = await loginApi.createBatch({
|
||||
account_ids: accountIds,
|
||||
max_geetest_retries: 5,
|
||||
concurrency,
|
||||
max_proxy_retries: maxProxyRetries,
|
||||
max_login_retries: 3,
|
||||
max_total_time: 300,
|
||||
});
|
||||
setBatchId(result.batch_id);
|
||||
message.success(`已创建登录任务,共 ${result.count} 个账号`);
|
||||
@@ -347,19 +338,6 @@ export default function LoginTasksPage() {
|
||||
/>
|
||||
</Space>
|
||||
</Tooltip>
|
||||
<Tooltip title="代理切换次数,0=无限切换直到成功">
|
||||
<Space size={4}>
|
||||
<SwapOutlined style={{ color: token.colorTextSecondary }} />
|
||||
<InputNumber
|
||||
min={0}
|
||||
max={999}
|
||||
value={maxProxyRetries}
|
||||
onChange={(v) => setMaxProxyRetries(v ?? 10)}
|
||||
style={{ width: 55 }}
|
||||
size="small"
|
||||
/>
|
||||
</Space>
|
||||
</Tooltip>
|
||||
<Button
|
||||
type="primary"
|
||||
icon={<PlayCircleOutlined />}
|
||||
|
||||
Reference in New Issue
Block a user