feat(huya): 多选登录改单线程队列并拆分路由与工作台
默认同时只登一个号,失败两次跳下一个,号间留间隔,结束后可一键重试失败账号。 顺带拆分虎牙路由与斗鱼工作台页面,并补齐 raw_cookie 重建入口。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -3,7 +3,7 @@ import {
|
||||
Button, Card, Col, Dropdown, Input, Popconfirm, Row, Space, Statistic, Table, Tag, theme, Typography,
|
||||
} from 'antd';
|
||||
import { message } from '../utils/antdMessage';
|
||||
import { CopyOutlined, DeleteOutlined, DownloadOutlined, SearchOutlined } from '@ant-design/icons';
|
||||
import { CopyOutlined, DeleteOutlined, DownloadOutlined, ReloadOutlined, SearchOutlined } from '@ant-design/icons';
|
||||
import { huyaApi, type BasicSummary, type HuyaCookieItem } from '../api/modules';
|
||||
import { usePermissions } from '../hooks/usePermissions';
|
||||
import { formatTime } from '../utils/time';
|
||||
@@ -52,6 +52,7 @@ export default function HuyaCookiePage() {
|
||||
const canManage = can('huya:account');
|
||||
const canView = can('huya:cookie:view') || can('huya:cookie:export') || canManage;
|
||||
const canExport = can('huya:cookie:export') || canManage;
|
||||
const canRebuild = can('huya:import') || can('huya:task') || canExport;
|
||||
|
||||
const loadCookies = useCallback(async () => {
|
||||
setLoading(true);
|
||||
@@ -145,6 +146,16 @@ export default function HuyaCookiePage() {
|
||||
}
|
||||
};
|
||||
|
||||
const handleRebuild = async (record: HuyaCookieItem) => {
|
||||
try {
|
||||
await huyaApi.rebuildWebCookie(record.account_id);
|
||||
message.success(`已从原始凭据重建 ${record.account_username} 的网页 Cookie`);
|
||||
loadCookies();
|
||||
} catch (e: unknown) {
|
||||
message.error(getErrorMessage(e));
|
||||
}
|
||||
};
|
||||
|
||||
const handleDeleteSelected = async () => {
|
||||
if (selectedRowKeys.length === 0) {
|
||||
message.warning('请先选择要清除的 Cookie');
|
||||
@@ -201,7 +212,7 @@ export default function HuyaCookiePage() {
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
width: 130,
|
||||
width: 210,
|
||||
align: 'center' as const,
|
||||
fixed: 'right' as const,
|
||||
render: (_: unknown, record: HuyaCookieItem) => (
|
||||
@@ -209,6 +220,15 @@ export default function HuyaCookiePage() {
|
||||
<Button size="small" icon={<CopyOutlined />} onClick={() => handleCopyCookie(record)}>
|
||||
复制
|
||||
</Button>
|
||||
{canRebuild && record.has_raw_cookie && (
|
||||
<Popconfirm
|
||||
title="用 App 原始凭据重建网页 Cookie?"
|
||||
description="不会重新登录或下单,只补齐网页设备字段。"
|
||||
onConfirm={() => handleRebuild(record)}
|
||||
>
|
||||
<Button size="small" icon={<ReloadOutlined />}>重建</Button>
|
||||
</Popconfirm>
|
||||
)}
|
||||
{canExport && (
|
||||
<Popconfirm title="确认清除这条 Cookie?" onConfirm={() => handleDelete(record.id)}>
|
||||
<Button danger size="small" icon={<DeleteOutlined />} />
|
||||
|
||||
Reference in New Issue
Block a user