增加斗鱼账号检测功能
This commit is contained in:
@@ -10,6 +10,7 @@ const LoginPage = lazy(() => import('./pages/LoginPage'));
|
||||
const MainLayout = lazy(() => import('./layouts/MainLayout'));
|
||||
const DashboardPage = lazy(() => import('./pages/DashboardPage'));
|
||||
const AccountsPage = lazy(() => import('./pages/AccountsPage'));
|
||||
const AccountCheckPage = lazy(() => import('./pages/AccountCheckPage'));
|
||||
const AssignmentsPage = lazy(() => import('./pages/AssignmentsPage'));
|
||||
const LoginTasksPage = lazy(() => import('./pages/LoginTasksPage'));
|
||||
const ProxyPage = lazy(() => import('./pages/ProxyPage'));
|
||||
@@ -63,6 +64,7 @@ function AppContent() {
|
||||
>
|
||||
<Route index element={lazyRoute(<DashboardPage />)} />
|
||||
<Route path="accounts" element={lazyRoute(<AccountsPage />)} />
|
||||
<Route path="account-check" element={lazyRoute(<AccountCheckPage />)} />
|
||||
<Route path="assignments" element={lazyRoute(<AssignmentsPage />)} />
|
||||
<Route path="login-tasks" element={lazyRoute(<LoginTasksPage />)} />
|
||||
<Route path="cookies" element={lazyRoute(<CookiePage />)} />
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import api from './client';
|
||||
import type { AccountCheckBatch, AccountCheckBatchRequest, MessageResponse } from './types';
|
||||
|
||||
export const accountCheckApi = {
|
||||
start: (data: AccountCheckBatchRequest) =>
|
||||
api.post<AccountCheckBatch, AccountCheckBatch>('/account-check/batches', data),
|
||||
getBatch: (batchId: string) =>
|
||||
api.get<AccountCheckBatch, AccountCheckBatch>(`/account-check/batches/${batchId}`),
|
||||
stop: (batchId: string) =>
|
||||
api.post<MessageResponse, MessageResponse>(`/account-check/batches/${batchId}/stop`),
|
||||
download: (batchId: string) =>
|
||||
api.get<Blob, Blob>(`/account-check/batches/${batchId}/download`, { responseType: 'blob' }),
|
||||
};
|
||||
@@ -7,6 +7,7 @@ interface CreateBatchParams {
|
||||
max_login_retries?: number;
|
||||
max_total_time?: number;
|
||||
api_strategy?: string;
|
||||
mode?: 'login' | 'check';
|
||||
}
|
||||
|
||||
export const loginApi = {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
export * from './types';
|
||||
export { accountCheckApi } from './accountCheck';
|
||||
export { accountApi } from './accounts';
|
||||
export { appApi } from './app';
|
||||
export { authApi } from './auth';
|
||||
|
||||
@@ -94,6 +94,43 @@ export interface BatchLoginResult {
|
||||
success: boolean;
|
||||
}
|
||||
|
||||
// ==================== Account Check ====================
|
||||
|
||||
export interface AccountCheckBatchRequest {
|
||||
text: string;
|
||||
concurrency?: number;
|
||||
max_login_retries?: number;
|
||||
max_total_time?: number;
|
||||
}
|
||||
|
||||
export interface AccountCheckItem {
|
||||
line: number;
|
||||
username: string;
|
||||
email: string;
|
||||
status: string;
|
||||
message: string;
|
||||
started_at: string | null;
|
||||
finished_at: string | null;
|
||||
}
|
||||
|
||||
export interface AccountCheckBatch {
|
||||
batch_id: string;
|
||||
status: string;
|
||||
message: string;
|
||||
created_by: number;
|
||||
concurrency: number;
|
||||
max_login_retries: number;
|
||||
max_total_time: number;
|
||||
total: number;
|
||||
finished_count: number;
|
||||
running_count: number;
|
||||
status_counts: Record<string, number>;
|
||||
created_at: string | null;
|
||||
started_at: string | null;
|
||||
finished_at: string | null;
|
||||
items: AccountCheckItem[];
|
||||
}
|
||||
|
||||
// ==================== Cookie ====================
|
||||
|
||||
export interface CookieItem {
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
CloudServerOutlined, TeamOutlined, ApiOutlined, KeyOutlined,
|
||||
MenuFoldOutlined, MenuUnfoldOutlined, SwapOutlined,
|
||||
SunOutlined, MoonOutlined, DesktopOutlined, GiftOutlined, ShoppingCartOutlined, ApartmentOutlined, MobileOutlined,
|
||||
SafetyCertificateOutlined,
|
||||
} from '@ant-design/icons';
|
||||
import { useNavigate, useLocation, Outlet } from 'react-router-dom';
|
||||
import { getUser, clearAuth, type AuthUser } from '../store/auth';
|
||||
@@ -57,6 +58,9 @@ export default function MainLayout({ onLogout }: { onLogout?: () => void }) {
|
||||
if (canAny(['account:view_all', 'account:view_assigned'])) {
|
||||
douyuItems.push({ key: '/accounts', label: '账号管理', icon: <UserOutlined /> });
|
||||
}
|
||||
if (canAny(['account:check', 'login:batch'])) {
|
||||
douyuItems.push({ key: '/account-check', label: '账号检测', icon: <SafetyCertificateOutlined /> });
|
||||
}
|
||||
if (can('account:assign')) {
|
||||
douyuItems.push({ key: '/assignments', label: '分配管理', icon: <SwapOutlined /> });
|
||||
}
|
||||
|
||||
@@ -0,0 +1,365 @@
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import {
|
||||
Button, Card, Col, Input, InputNumber, message, Popconfirm, Row, Space, Statistic, Table, Tag, Typography,
|
||||
} from 'antd';
|
||||
import type { TableProps } from 'antd';
|
||||
import { DownloadOutlined, PlayCircleOutlined, ReloadOutlined, StopOutlined } from '@ant-design/icons';
|
||||
import { accountCheckApi, type AccountCheckBatch, type AccountCheckItem } from '../api/modules';
|
||||
import { formatTime } from '../utils/time';
|
||||
import { getErrorMessage } from '../utils/error';
|
||||
|
||||
const { TextArea } = Input;
|
||||
const { Text, Title } = Typography;
|
||||
|
||||
const FORM_STORAGE_KEY = 'douyu_account_check_form';
|
||||
const BATCH_STORAGE_KEY = 'douyu_account_check_batch_id';
|
||||
|
||||
const STATUS_LABELS: Record<string, string> = {
|
||||
pending: '等待',
|
||||
running: '检测中',
|
||||
account_cancelled: '账号已注销',
|
||||
password_wrong: '账号密码错误',
|
||||
account_unverified: '账号未认证',
|
||||
account_verified: '账号已认证',
|
||||
account_auth_unknown: '认证状态未知',
|
||||
error: '检测失败',
|
||||
stopped: '已停止',
|
||||
};
|
||||
|
||||
const STATUS_COLORS: Record<string, string> = {
|
||||
pending: 'default',
|
||||
running: 'processing',
|
||||
account_cancelled: 'error',
|
||||
password_wrong: 'error',
|
||||
account_unverified: 'warning',
|
||||
account_verified: 'success',
|
||||
account_auth_unknown: 'warning',
|
||||
error: 'error',
|
||||
stopped: 'warning',
|
||||
};
|
||||
|
||||
const FINISHED_BATCH_STATUS = new Set(['finished', 'stopped', 'error']);
|
||||
const RUNNING_BATCH_STATUS = new Set(['pending', 'running']);
|
||||
|
||||
function readStoredText() {
|
||||
try {
|
||||
return localStorage.getItem(FORM_STORAGE_KEY) || '';
|
||||
} catch {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
function readStoredBatchId() {
|
||||
try {
|
||||
return localStorage.getItem(BATCH_STORAGE_KEY) || '';
|
||||
} catch {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
function readStoredNumber(key: string, fallback: number) {
|
||||
try {
|
||||
const raw = localStorage.getItem(key);
|
||||
if (raw === null) return fallback;
|
||||
const value = Number(raw);
|
||||
return Number.isFinite(value) ? value : fallback;
|
||||
} catch {
|
||||
return fallback;
|
||||
}
|
||||
}
|
||||
|
||||
function downloadBlob(blob: Blob, filename: string) {
|
||||
const url = URL.createObjectURL(blob);
|
||||
const link = document.createElement('a');
|
||||
link.href = url;
|
||||
link.download = filename;
|
||||
link.click();
|
||||
URL.revokeObjectURL(url);
|
||||
}
|
||||
|
||||
function fileTimestamp() {
|
||||
const d = new Date();
|
||||
const pad = (n: number) => String(n).padStart(2, '0');
|
||||
return `${d.getFullYear()}${pad(d.getMonth() + 1)}${pad(d.getDate())}_${pad(d.getHours())}${pad(d.getMinutes())}${pad(d.getSeconds())}`;
|
||||
}
|
||||
|
||||
export default function AccountCheckPage() {
|
||||
const [text, setText] = useState(readStoredText);
|
||||
const [concurrency, setConcurrency] = useState(() => readStoredNumber('account_check_concurrency', 3));
|
||||
const [maxTotalTime, setMaxTotalTime] = useState(() => readStoredNumber('account_check_max_total_time', 300));
|
||||
const [maxLoginRetries, setMaxLoginRetries] = useState(() => readStoredNumber('account_check_max_login_retries', 0));
|
||||
const [batch, setBatch] = useState<AccountCheckBatch | null>(null);
|
||||
const [starting, setStarting] = useState(false);
|
||||
const [refreshing, setRefreshing] = useState(false);
|
||||
const [stopping, setStopping] = useState(false);
|
||||
const [downloading, setDownloading] = useState(false);
|
||||
const restoredBatchRef = useRef(false);
|
||||
|
||||
const batchId = batch?.batch_id || '';
|
||||
const isRunning = !!batch && RUNNING_BATCH_STATUS.has(batch.status);
|
||||
const canDownload = !!batch && FINISHED_BATCH_STATUS.has(batch.status);
|
||||
|
||||
const loadBatchById = useCallback(async (id: string) => {
|
||||
if (!id) return;
|
||||
setRefreshing(true);
|
||||
try {
|
||||
const data = await accountCheckApi.getBatch(id);
|
||||
setBatch(data);
|
||||
localStorage.setItem(BATCH_STORAGE_KEY, data.batch_id);
|
||||
} catch (e: unknown) {
|
||||
const err = getErrorMessage(e);
|
||||
if (err.includes('批次不存在') || err.includes('服务已重启')) {
|
||||
localStorage.removeItem(BATCH_STORAGE_KEY);
|
||||
setBatch(null);
|
||||
message.warning('上次账号检测批次已不存在,已清除恢复记录');
|
||||
} else {
|
||||
message.error(err);
|
||||
}
|
||||
} finally {
|
||||
setRefreshing(false);
|
||||
}
|
||||
}, []);
|
||||
|
||||
const refreshBatch = useCallback(async () => {
|
||||
if (!batchId) return;
|
||||
await loadBatchById(batchId);
|
||||
}, [batchId, loadBatchById]);
|
||||
|
||||
useEffect(() => {
|
||||
localStorage.setItem(FORM_STORAGE_KEY, text);
|
||||
}, [text]);
|
||||
|
||||
useEffect(() => {
|
||||
localStorage.setItem('account_check_concurrency', String(concurrency));
|
||||
}, [concurrency]);
|
||||
|
||||
useEffect(() => {
|
||||
localStorage.setItem('account_check_max_total_time', String(maxTotalTime));
|
||||
}, [maxTotalTime]);
|
||||
|
||||
useEffect(() => {
|
||||
localStorage.setItem('account_check_max_login_retries', String(maxLoginRetries));
|
||||
}, [maxLoginRetries]);
|
||||
|
||||
useEffect(() => {
|
||||
if (restoredBatchRef.current) return;
|
||||
restoredBatchRef.current = true;
|
||||
const storedBatchId = readStoredBatchId();
|
||||
if (storedBatchId) {
|
||||
loadBatchById(storedBatchId);
|
||||
}
|
||||
}, [loadBatchById]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!isRunning || !batchId) return undefined;
|
||||
const timer = window.setInterval(() => {
|
||||
refreshBatch();
|
||||
}, 2000);
|
||||
return () => window.clearInterval(timer);
|
||||
}, [batchId, isRunning, refreshBatch]);
|
||||
|
||||
const statusCounts = batch?.status_counts || {};
|
||||
const categoryStats = useMemo(() => [
|
||||
{ title: '已注销', value: statusCounts.account_cancelled || 0 },
|
||||
{ title: '密码错误', value: statusCounts.password_wrong || 0 },
|
||||
{ title: '未认证', value: statusCounts.account_unverified || 0 },
|
||||
{ title: '已认证', value: statusCounts.account_verified || 0 },
|
||||
], [statusCounts]);
|
||||
|
||||
const handleStart = async () => {
|
||||
if (!text.trim()) {
|
||||
message.warning('请先导入账号');
|
||||
return;
|
||||
}
|
||||
setStarting(true);
|
||||
try {
|
||||
const data = await accountCheckApi.start({
|
||||
text,
|
||||
concurrency,
|
||||
max_total_time: maxTotalTime,
|
||||
max_login_retries: maxLoginRetries,
|
||||
});
|
||||
setBatch(data);
|
||||
localStorage.setItem(BATCH_STORAGE_KEY, data.batch_id);
|
||||
message.success(`账号检测批次已启动,共 ${data.total} 个账号`);
|
||||
} catch (e: unknown) {
|
||||
message.error(getErrorMessage(e));
|
||||
} finally {
|
||||
setStarting(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleStop = async () => {
|
||||
if (!batchId) return;
|
||||
setStopping(true);
|
||||
try {
|
||||
const result = await accountCheckApi.stop(batchId);
|
||||
message.success(result.message);
|
||||
refreshBatch();
|
||||
} catch (e: unknown) {
|
||||
message.error(getErrorMessage(e));
|
||||
} finally {
|
||||
setStopping(false);
|
||||
}
|
||||
};
|
||||
|
||||
const handleDownload = async () => {
|
||||
if (!batchId) return;
|
||||
setDownloading(true);
|
||||
try {
|
||||
const blob = await accountCheckApi.download(batchId);
|
||||
downloadBlob(blob instanceof Blob ? blob : new Blob([blob]), `account-check-${fileTimestamp()}.zip`);
|
||||
message.success('已下载压缩包');
|
||||
} catch (e: unknown) {
|
||||
message.error(getErrorMessage(e));
|
||||
} finally {
|
||||
setDownloading(false);
|
||||
}
|
||||
};
|
||||
|
||||
const columns: TableProps<AccountCheckItem>['columns'] = [
|
||||
{ title: '行', dataIndex: 'line', width: 70 },
|
||||
{ title: '账号', dataIndex: 'username', width: 180, ellipsis: true },
|
||||
{ title: '邮箱', dataIndex: 'email', width: 220, ellipsis: true },
|
||||
{
|
||||
title: '状态',
|
||||
dataIndex: 'status',
|
||||
width: 130,
|
||||
render: (status: string) => (
|
||||
<Tag color={STATUS_COLORS[status] || 'default'}>
|
||||
{STATUS_LABELS[status] || status}
|
||||
</Tag>
|
||||
),
|
||||
},
|
||||
{ title: '消息', dataIndex: 'message', ellipsis: true },
|
||||
{
|
||||
title: '完成时间',
|
||||
dataIndex: 'finished_at',
|
||||
width: 180,
|
||||
render: (value: string | null) => formatTime(value),
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<Space direction="vertical" size={16} style={{ width: '100%' }}>
|
||||
<Title level={3} style={{ margin: 0 }}>账号检测</Title>
|
||||
|
||||
<Card title="导入账号">
|
||||
<Space direction="vertical" size={12} style={{ width: '100%' }}>
|
||||
<TextArea
|
||||
rows={9}
|
||||
value={text}
|
||||
onChange={(event) => setText(event.target.value)}
|
||||
placeholder={'用户3751569049----19910724----eRRWGm@nnw.pw----aa778899\n用户1508769674|aa778899|CBXFbx@nnw.pw|aa778899'}
|
||||
disabled={isRunning}
|
||||
/>
|
||||
<Row gutter={[12, 12]} align="bottom">
|
||||
<Col xs={8} md={4}>
|
||||
<Text type="secondary">并发</Text>
|
||||
<InputNumber
|
||||
min={1}
|
||||
max={10}
|
||||
value={concurrency}
|
||||
onChange={(value) => setConcurrency(Number(value || 1))}
|
||||
disabled={isRunning}
|
||||
style={{ width: '100%' }}
|
||||
/>
|
||||
</Col>
|
||||
<Col xs={8} md={4}>
|
||||
<Text type="secondary">单账号超时</Text>
|
||||
<InputNumber
|
||||
min={0}
|
||||
max={3600}
|
||||
step={30}
|
||||
value={maxTotalTime}
|
||||
onChange={(value) => setMaxTotalTime(Number(value ?? 0))}
|
||||
disabled={isRunning}
|
||||
addonAfter="秒"
|
||||
style={{ width: '100%' }}
|
||||
/>
|
||||
</Col>
|
||||
<Col xs={8} md={4}>
|
||||
<Text type="secondary">重试次数</Text>
|
||||
<InputNumber
|
||||
min={0}
|
||||
max={50}
|
||||
value={maxLoginRetries}
|
||||
onChange={(value) => setMaxLoginRetries(Number(value ?? 0))}
|
||||
disabled={isRunning}
|
||||
addonAfter="次"
|
||||
style={{ width: '100%' }}
|
||||
/>
|
||||
</Col>
|
||||
<Col xs={24} md={12}>
|
||||
<Space wrap>
|
||||
<Button
|
||||
type="primary"
|
||||
icon={<PlayCircleOutlined />}
|
||||
loading={starting}
|
||||
disabled={isRunning}
|
||||
onClick={handleStart}
|
||||
>
|
||||
开始检测
|
||||
</Button>
|
||||
<Button
|
||||
danger
|
||||
icon={<StopOutlined />}
|
||||
loading={stopping}
|
||||
disabled={!isRunning}
|
||||
onClick={handleStop}
|
||||
>
|
||||
停止
|
||||
</Button>
|
||||
<Popconfirm
|
||||
title="清空导入内容?"
|
||||
onConfirm={() => setText('')}
|
||||
disabled={isRunning || !text}
|
||||
okText="清空"
|
||||
cancelText="取消"
|
||||
>
|
||||
<Button disabled={isRunning || !text}>清空</Button>
|
||||
</Popconfirm>
|
||||
</Space>
|
||||
</Col>
|
||||
</Row>
|
||||
</Space>
|
||||
</Card>
|
||||
|
||||
<Card
|
||||
title="检测结果"
|
||||
extra={(
|
||||
<Space>
|
||||
<Button icon={<ReloadOutlined />} loading={refreshing} disabled={!batchId} onClick={refreshBatch}>
|
||||
刷新
|
||||
</Button>
|
||||
<Button icon={<DownloadOutlined />} loading={downloading} disabled={!canDownload} onClick={handleDownload}>
|
||||
下载压缩包
|
||||
</Button>
|
||||
</Space>
|
||||
)}
|
||||
>
|
||||
<Row gutter={[16, 16]} style={{ marginBottom: 16 }}>
|
||||
<Col xs={12} md={4}><Statistic title="总数" value={batch?.total || 0} /></Col>
|
||||
<Col xs={12} md={4}><Statistic title="完成" value={batch?.finished_count || 0} /></Col>
|
||||
<Col xs={12} md={4}><Statistic title="运行中" value={batch?.running_count || 0} /></Col>
|
||||
<Col xs={12} md={4}><Statistic title="失败" value={statusCounts.error || 0} /></Col>
|
||||
<Col xs={12} md={4}><Statistic title="状态" value={batch ? batch.message : '-'} /></Col>
|
||||
<Col xs={12} md={4}><Statistic title="批次" value={batchId || '-'} /></Col>
|
||||
{categoryStats.map((item) => (
|
||||
<Col xs={12} md={4} key={item.title}>
|
||||
<Statistic title={item.title} value={item.value} />
|
||||
</Col>
|
||||
))}
|
||||
</Row>
|
||||
<Table
|
||||
rowKey="line"
|
||||
columns={columns}
|
||||
dataSource={batch?.items || []}
|
||||
loading={refreshing && !isRunning}
|
||||
pagination={{ pageSize: 20, showSizeChanger: true }}
|
||||
scroll={{ x: 920 }}
|
||||
/>
|
||||
</Card>
|
||||
</Space>
|
||||
);
|
||||
}
|
||||
@@ -2,7 +2,10 @@ import { useEffect, useState, useMemo, useCallback } from 'react';
|
||||
import {
|
||||
Table, Button, Select, message, Tag, Space, InputNumber, Tooltip, Popconfirm, theme, Modal, Form,
|
||||
} from 'antd';
|
||||
import { PlayCircleOutlined, StopOutlined, FilterOutlined, ReloadOutlined, DeleteOutlined, SettingOutlined } from '@ant-design/icons';
|
||||
import {
|
||||
PlayCircleOutlined, StopOutlined, FilterOutlined, ReloadOutlined, DeleteOutlined,
|
||||
SettingOutlined, SafetyCertificateOutlined,
|
||||
} from '@ant-design/icons';
|
||||
import { accountApi, loginApi, type AccountItem, type LoginTaskItem } from '../api/modules';
|
||||
import RealtimeLogPanel from '../components/RealtimeLogPanel';
|
||||
import { usePermissions } from '../hooks/usePermissions';
|
||||
@@ -16,6 +19,11 @@ const STATUS_COLORS: Record<string, string> = {
|
||||
success: 'success',
|
||||
failed: 'error',
|
||||
error: 'error',
|
||||
account_cancelled: 'error',
|
||||
password_wrong: 'error',
|
||||
account_unverified: 'warning',
|
||||
account_verified: 'success',
|
||||
account_auth_unknown: 'warning',
|
||||
};
|
||||
|
||||
const STATUS_LABELS: Record<string, string> = {
|
||||
@@ -24,8 +32,15 @@ const STATUS_LABELS: Record<string, string> = {
|
||||
success: '成功',
|
||||
failed: '失败',
|
||||
error: '异常',
|
||||
account_cancelled: '账号已注销',
|
||||
password_wrong: '账号密码错误',
|
||||
account_unverified: '账号未认证',
|
||||
account_verified: '账号已认证',
|
||||
account_auth_unknown: '认证状态未知',
|
||||
};
|
||||
|
||||
type BatchMode = 'login' | 'check';
|
||||
|
||||
interface SelectGroupOption {
|
||||
label: string;
|
||||
options: { value: number; label: string }[];
|
||||
@@ -146,8 +161,8 @@ export default function LoginTasksPage() {
|
||||
return () => clearInterval(timer);
|
||||
}, [loadTasks]);
|
||||
|
||||
// 共享的批量登录启动逻辑
|
||||
const startBatch = async (accountIds: number[]) => {
|
||||
// 共享的批量任务启动逻辑
|
||||
const startBatch = async (accountIds: number[], mode: BatchMode = 'login') => {
|
||||
if (accountIds.length === 0) {
|
||||
message.warning('请选择账号');
|
||||
return;
|
||||
@@ -161,9 +176,10 @@ export default function LoginTasksPage() {
|
||||
max_login_retries: maxLoginRetries,
|
||||
max_total_time: maxTotalTime,
|
||||
api_strategy: apiStrategy,
|
||||
mode,
|
||||
});
|
||||
setBatchId(result.batch_id);
|
||||
message.success(`已创建登录任务,共 ${result.count} 个账号`);
|
||||
message.success(`已创建${mode === 'check' ? '检测' : '登录'}任务,共 ${result.count} 个账号`);
|
||||
|
||||
connectLogs(`/api/login/ws/login/${result.batch_id}`, {
|
||||
onClose: () => { setBatchId(null); setStarting(false); },
|
||||
@@ -178,7 +194,8 @@ export default function LoginTasksPage() {
|
||||
}
|
||||
};
|
||||
|
||||
const handleBatchLogin = () => startBatch(selectedIds);
|
||||
const handleBatchLogin = () => startBatch(selectedIds, 'login');
|
||||
const handleBatchCheck = () => startBatch(selectedIds, 'check');
|
||||
|
||||
// 重试当前批次所有失败的任务
|
||||
const handleRetryFailed = () => {
|
||||
@@ -189,14 +206,14 @@ export default function LoginTasksPage() {
|
||||
message.info('没有失败的任务');
|
||||
return;
|
||||
}
|
||||
startBatch(failedIds);
|
||||
startBatch(failedIds, 'login');
|
||||
};
|
||||
|
||||
// 重试单个失败任务
|
||||
const handleRetryOne = (taskId: number) => {
|
||||
const task = tasks.find((t) => t.id === taskId);
|
||||
if (!task) return;
|
||||
startBatch([task.account_id]);
|
||||
startBatch([task.account_id], 'login');
|
||||
};
|
||||
|
||||
const handleStop = async () => {
|
||||
@@ -238,6 +255,13 @@ export default function LoginTasksPage() {
|
||||
|
||||
const successCount = tasks.filter((t) => t.status === 'success').length;
|
||||
const failedCount = tasks.filter((t) => ['failed', 'error'].includes(t.status)).length;
|
||||
const checkedCount = tasks.filter((t) => [
|
||||
'account_cancelled',
|
||||
'password_wrong',
|
||||
'account_unverified',
|
||||
'account_verified',
|
||||
'account_auth_unknown',
|
||||
].includes(t.status)).length;
|
||||
|
||||
const columns = [
|
||||
{ title: 'ID', dataIndex: 'id', width: 60 },
|
||||
@@ -354,6 +378,15 @@ export default function LoginTasksPage() {
|
||||
size="small"
|
||||
/>
|
||||
</Tooltip>
|
||||
<Button
|
||||
icon={<SafetyCertificateOutlined />}
|
||||
loading={loading}
|
||||
onClick={handleBatchCheck}
|
||||
disabled={selectedIds.length === 0 || starting}
|
||||
size="small"
|
||||
>
|
||||
检测账号
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
icon={<PlayCircleOutlined />}
|
||||
@@ -380,6 +413,7 @@ export default function LoginTasksPage() {
|
||||
<span>共 <b>{tasks.length}</b> 个任务</span>
|
||||
<span>成功 <b style={{ color: token.colorSuccess }}>{successCount}</b></span>
|
||||
<span>失败 <b style={{ color: token.colorError }}>{failedCount}</b></span>
|
||||
{checkedCount > 0 && <span>检测 <b>{checkedCount}</b></span>}
|
||||
{batchId && <span>批次: <b>{batchId}</b></span>}
|
||||
<div style={{ flex: 1 }} />
|
||||
{selectedRowKeys.length > 0 && (
|
||||
|
||||
Reference in New Issue
Block a user