修复虎牙任务台卡死与轮询过重,并调整默认端口
默认端口改为后端 8800 / 前端 5174,避免多项目冲突。 清理无执行器的残留 running 任务,支持停止无效批次;绑定二维码结果页不再被假活跃批次锁死。 任务列表默认剥离 base64 小程序码,按需拉取详情,空闲轮询降频,显著降低 tasks 请求体积。
This commit is contained in:
@@ -59,6 +59,8 @@ export const huyaApi = {
|
||||
api.get<HuyaRegisterSuccessLog[], HuyaRegisterSuccessLog[]>('/huya/register/success-logs', { params }),
|
||||
exportRegisterSuccessLogs: (params?: { batch_id?: string; tag?: string; limit?: number }) =>
|
||||
api.get<Blob, Blob>('/huya/register/success-logs/export', { responseType: 'blob', params }),
|
||||
stopBatch: (batchId: string) =>
|
||||
api.post<MessageResponse, MessageResponse>(`/huya/stop/${batchId}`),
|
||||
assign: (id: number, assigned_to: number | null) =>
|
||||
api.put<MessageResponse, MessageResponse>(`/huya/accounts/${id}/assign`, { assigned_to }),
|
||||
batchAssign: (account_ids: number[], assigned_to: number | null) =>
|
||||
@@ -85,5 +87,10 @@ export const huyaApi = {
|
||||
createTasks: (data: HuyaTaskBatchRequest) =>
|
||||
api.post<HuyaTaskBatchResult, HuyaTaskBatchResult>('/huya/tasks/batch', data),
|
||||
listTasks: (batchId?: string) =>
|
||||
api.get<HuyaTaskItem[], HuyaTaskItem[]>('/huya/tasks', { params: batchId ? { batch_id: batchId } : {} }),
|
||||
api.get<HuyaTaskItem[], HuyaTaskItem[]>('/huya/tasks', {
|
||||
// 列表轮询默认不带 base64 小程序码,避免每次 1MB+ 流量。
|
||||
params: batchId ? { batch_id: batchId, include_images: false } : { include_images: false },
|
||||
}),
|
||||
getTask: (taskId: number) =>
|
||||
api.get<HuyaTaskItem, HuyaTaskItem>(`/huya/tasks/${taskId}`),
|
||||
};
|
||||
|
||||
@@ -7,7 +7,7 @@ import type { Dayjs } from 'dayjs';
|
||||
import type { MouseEvent as ReactMouseEvent } from 'react';
|
||||
import {
|
||||
AppstoreOutlined, CheckCircleOutlined, CreditCardOutlined, FieldTimeOutlined,
|
||||
ImportOutlined, LinkOutlined, MoreOutlined, PlayCircleOutlined, QrcodeOutlined, ReloadOutlined, SearchOutlined, SettingOutlined, ShoppingOutlined,
|
||||
ImportOutlined, LinkOutlined, MoreOutlined, PlayCircleOutlined, QrcodeOutlined, ReloadOutlined, SearchOutlined, SettingOutlined, ShoppingOutlined, StopOutlined,
|
||||
} from '@ant-design/icons';
|
||||
import {
|
||||
huyaApi,
|
||||
@@ -56,6 +56,7 @@ const STATUS_COLORS: Record<string, string> = {
|
||||
success: 'success',
|
||||
failed: 'error',
|
||||
error: 'error',
|
||||
stopped: 'warning',
|
||||
};
|
||||
|
||||
const STATUS_LABELS: Record<string, string> = {
|
||||
@@ -65,6 +66,7 @@ const STATUS_LABELS: Record<string, string> = {
|
||||
success: '成功',
|
||||
failed: '失败',
|
||||
error: '异常',
|
||||
stopped: '已停止',
|
||||
};
|
||||
|
||||
const ACCOUNT_STATUS_LABELS: Record<string, string> = {
|
||||
@@ -211,7 +213,32 @@ function formatPriceText(value: number | null | undefined): string {
|
||||
}
|
||||
|
||||
function hasMiniQrcode(task: HuyaTaskItem): boolean {
|
||||
return task.task_type === 'get_bind_qr' && Boolean(resultText(task.result, 'mini_qrcode_image'));
|
||||
if (task.task_type !== 'get_bind_qr') return false;
|
||||
if (resultText(task.result, 'mini_qrcode_image')) return true;
|
||||
return task.result?.has_mini_qrcode === true;
|
||||
}
|
||||
|
||||
function mergeTaskImageCache(
|
||||
items: HuyaTaskItem[],
|
||||
imageCache: Map<number, string>,
|
||||
): HuyaTaskItem[] {
|
||||
return items.map((task) => {
|
||||
const image = resultText(task.result, 'mini_qrcode_image');
|
||||
if (image) {
|
||||
imageCache.set(task.id, image);
|
||||
return task;
|
||||
}
|
||||
const cached = imageCache.get(task.id);
|
||||
if (!cached || !task.result) return task;
|
||||
return {
|
||||
...task,
|
||||
result: {
|
||||
...task.result,
|
||||
mini_qrcode_image: cached,
|
||||
has_mini_qrcode: true,
|
||||
},
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function bindReadyForConfirm(task: HuyaTaskItem | null | undefined): boolean {
|
||||
@@ -267,6 +294,7 @@ export default function HuyaTasksPage() {
|
||||
});
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [starting, setStarting] = useState(false);
|
||||
const [stopping, setStopping] = useState(false);
|
||||
const [savingConfig, setSavingConfig] = useState(false);
|
||||
const [taskRecordsVisible, setTaskRecordsVisible] = useState(false);
|
||||
const [batchId, setBatchId] = useState<string | null>(null);
|
||||
@@ -277,6 +305,7 @@ export default function HuyaTasksPage() {
|
||||
const autoOpenQrReady = useRef(false);
|
||||
const autoOpenedPayTaskIds = useRef<Set<number>>(new Set());
|
||||
const autoOpenPayReady = useRef(false);
|
||||
const qrImageCacheRef = useRef<Map<number, string>>(new Map());
|
||||
const notifiedPaidTaskIds = useRef<Set<number>>(new Set());
|
||||
const accountTableAreaRef = useRef<HTMLDivElement | null>(null);
|
||||
const [accountTableAreaHeight, setAccountTableAreaHeight] = useState(460);
|
||||
@@ -323,7 +352,34 @@ export default function HuyaTasksPage() {
|
||||
|
||||
const openQrTask = useCallback((task: HuyaTaskItem) => {
|
||||
autoOpenedQrTaskIds.current.add(task.id);
|
||||
const cachedImage = qrImageCacheRef.current.get(task.id);
|
||||
const currentImage = resultText(task.result, 'mini_qrcode_image');
|
||||
if (currentImage) {
|
||||
qrImageCacheRef.current.set(task.id, currentImage);
|
||||
setQrTask(task);
|
||||
return;
|
||||
}
|
||||
if (cachedImage) {
|
||||
setQrTask({
|
||||
...task,
|
||||
result: {
|
||||
...(task.result || {}),
|
||||
mini_qrcode_image: cachedImage,
|
||||
has_mini_qrcode: true,
|
||||
},
|
||||
});
|
||||
return;
|
||||
}
|
||||
setQrTask(task);
|
||||
// 列表接口默认不带 base64,打开弹窗时再拉详情。
|
||||
void huyaApi.getTask(task.id).then((detail) => {
|
||||
const image = resultText(detail.result, 'mini_qrcode_image');
|
||||
if (image) qrImageCacheRef.current.set(detail.id, image);
|
||||
setQrTask((current) => (current && current.id === detail.id ? detail : current));
|
||||
setTasks((prev) => prev.map((item) => (item.id === detail.id ? detail : item)));
|
||||
}).catch(() => {
|
||||
// 详情失败时仍展示已有状态,不打断操作。
|
||||
});
|
||||
}, []);
|
||||
|
||||
const openPayTask = useCallback((task: HuyaTaskItem) => {
|
||||
@@ -356,9 +412,13 @@ export default function HuyaTasksPage() {
|
||||
setSelectedIds((prev) => prev.filter((id) => nextPoolById.has(id)));
|
||||
}
|
||||
if (taskResult.status === 'fulfilled') {
|
||||
rememberExistingQrcodes(taskResult.value);
|
||||
rememberExistingPaymentQrcodes(taskResult.value);
|
||||
setTasks(taskResult.value);
|
||||
const nextTasks = mergeTaskImageCache(taskResult.value, qrImageCacheRef.current);
|
||||
rememberExistingQrcodes(nextTasks);
|
||||
rememberExistingPaymentQrcodes(nextTasks);
|
||||
setTasks(nextTasks);
|
||||
if (!nextTasks.some((task) => ['pending', 'running'].includes(task.status))) {
|
||||
setBatchId(null);
|
||||
}
|
||||
}
|
||||
if (goodsResult.status === 'fulfilled') setGoods(goodsResult.value);
|
||||
if (rechargeGoodsResult.status === 'fulfilled') setRechargeGoods(rechargeGoodsResult.value);
|
||||
@@ -386,9 +446,13 @@ export default function HuyaTasksPage() {
|
||||
const loadTasks = useCallback(async () => {
|
||||
try {
|
||||
const data = await huyaApi.listTasks();
|
||||
rememberExistingQrcodes(data);
|
||||
rememberExistingPaymentQrcodes(data);
|
||||
setTasks(data);
|
||||
const nextTasks = mergeTaskImageCache(data, qrImageCacheRef.current);
|
||||
rememberExistingQrcodes(nextTasks);
|
||||
rememberExistingPaymentQrcodes(nextTasks);
|
||||
setTasks(nextTasks);
|
||||
if (!nextTasks.some((task) => ['pending', 'running'].includes(task.status))) {
|
||||
setBatchId(null);
|
||||
}
|
||||
} catch {
|
||||
// 轮询失败不打扰操作,下一轮继续刷新。
|
||||
}
|
||||
@@ -398,10 +462,16 @@ export default function HuyaTasksPage() {
|
||||
loadAll();
|
||||
}, [loadAll]);
|
||||
|
||||
// 有活跃任务时 3 秒轮询;空闲时 15 秒轻量刷新,避免 Network 面板一直刷 tasks。
|
||||
const hasActiveTasks = useMemo(
|
||||
() => tasks.some((task) => ['pending', 'running', 'planned'].includes(task.status)),
|
||||
[tasks],
|
||||
);
|
||||
useEffect(() => {
|
||||
const timer = setInterval(loadTasks, 3000);
|
||||
const intervalMs = hasActiveTasks || wsConnected ? 3000 : 15000;
|
||||
const timer = setInterval(loadTasks, intervalMs);
|
||||
return () => clearInterval(timer);
|
||||
}, [loadTasks]);
|
||||
}, [hasActiveTasks, loadTasks, wsConnected]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!autoOpenQrReady.current || qrTask) return;
|
||||
@@ -523,6 +593,16 @@ export default function HuyaTasksPage() {
|
||||
return map;
|
||||
}, [tasks]);
|
||||
|
||||
const latestQueryGameTaskByAccount = useMemo(() => {
|
||||
const map = new Map<number, HuyaTaskItem>();
|
||||
tasks.forEach((task) => {
|
||||
if (task.task_type !== 'query_game_name') return;
|
||||
const current = map.get(task.account_id);
|
||||
if (!current || task.id > current.id) map.set(task.account_id, task);
|
||||
});
|
||||
return map;
|
||||
}, [tasks]);
|
||||
|
||||
const latestGoodsTaskByAccount = useMemo(() => {
|
||||
const map = new Map<number, HuyaTaskItem>();
|
||||
tasks.forEach((task) => {
|
||||
@@ -542,6 +622,26 @@ export default function HuyaTasksPage() {
|
||||
? accountLabel(selectedAccounts[0])
|
||||
: `已选 ${selectedIds.length} 个账号`;
|
||||
|
||||
const runningTaskBatchId = useMemo(() => {
|
||||
// 支付监听会长期 running;绑定二维码若仍 running 也算活跃。
|
||||
// 但“已生成二维码/已识别角色”这类终态不应再锁 UI。
|
||||
const task = tasks.find((item) => {
|
||||
if (!['pending', 'running'].includes(item.status)) return false;
|
||||
if (item.task_type === 'create_recharge_order') {
|
||||
const status = paymentStatus(item);
|
||||
return !status || !['paid', 'timeout', 'stopped'].includes(status);
|
||||
}
|
||||
if (item.task_type === 'get_bind_qr') {
|
||||
// 旧版轮询中断后可能残留 running,但已有二维码结果;不作为活跃批次。
|
||||
if (hasMiniQrcode(item)) return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
return task?.batch_id || null;
|
||||
}, [tasks]);
|
||||
const activeBatchId = runningTaskBatchId || (wsConnected ? batchId : null);
|
||||
const batchBusy = Boolean(activeBatchId);
|
||||
|
||||
const sortedGoods = useMemo(() => {
|
||||
return [...goods].sort((a, b) => (
|
||||
goodsRawNumber(a, 'category_sort') - goodsRawNumber(b, 'category_sort')
|
||||
@@ -652,6 +752,10 @@ export default function HuyaTasksPage() {
|
||||
message.warning('请先选择虎牙 CK');
|
||||
return;
|
||||
}
|
||||
if (activeBatchId) {
|
||||
message.warning('当前已有虎牙批次在运行,请先停止或等待结束');
|
||||
return;
|
||||
}
|
||||
if (taskType === 'create_recharge_order' && !selectedRechargeGoodsId) {
|
||||
message.warning('请先选择充值商品');
|
||||
return;
|
||||
@@ -669,18 +773,26 @@ export default function HuyaTasksPage() {
|
||||
concurrency,
|
||||
payload: createPayload(taskType),
|
||||
});
|
||||
const finishTask = () => {
|
||||
setBatchId(null);
|
||||
setStarting(false);
|
||||
void loadAll();
|
||||
};
|
||||
setBatchId(result.batch_id);
|
||||
message.success(`已创建 ${taskTypes[taskType] || taskType},共 ${result.count} 个账号`);
|
||||
await loadTasks();
|
||||
connectLogs(`/api/huya/ws/${result.batch_id}`, {
|
||||
onClose: finishTask,
|
||||
onResult: finishTask,
|
||||
onError: finishTask,
|
||||
onClose: () => {
|
||||
setStarting(false);
|
||||
setStopping(false);
|
||||
void loadAll();
|
||||
},
|
||||
onResult: () => {
|
||||
setBatchId(null);
|
||||
setStarting(false);
|
||||
setStopping(false);
|
||||
void loadAll();
|
||||
},
|
||||
onError: () => {
|
||||
setStarting(false);
|
||||
setStopping(false);
|
||||
void loadAll();
|
||||
},
|
||||
});
|
||||
} catch (e: unknown) {
|
||||
message.error(getErrorMessage(e));
|
||||
@@ -688,6 +800,41 @@ export default function HuyaTasksPage() {
|
||||
}
|
||||
};
|
||||
|
||||
const handleStopBatch = async () => {
|
||||
if (!activeBatchId) {
|
||||
// 没有可识别活跃批次时,尝试清理历史残留 running。
|
||||
const stale = tasks.find((item) => ['pending', 'running'].includes(item.status));
|
||||
if (!stale?.batch_id) {
|
||||
message.warning('当前没有可停止的虎牙批次');
|
||||
return;
|
||||
}
|
||||
setStopping(true);
|
||||
try {
|
||||
const result = await huyaApi.stopBatch(stale.batch_id);
|
||||
message.success(result.message);
|
||||
setBatchId(null);
|
||||
setStarting(false);
|
||||
void loadAll();
|
||||
} catch (e: unknown) {
|
||||
message.error(getErrorMessage(e));
|
||||
} finally {
|
||||
setStopping(false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
setStopping(true);
|
||||
try {
|
||||
const result = await huyaApi.stopBatch(activeBatchId);
|
||||
message.success(result.message);
|
||||
setStarting(false);
|
||||
void loadTasks();
|
||||
} catch (e: unknown) {
|
||||
message.error(getErrorMessage(e));
|
||||
} finally {
|
||||
setStopping(false);
|
||||
}
|
||||
};
|
||||
|
||||
const accountActionItems: MenuProps['items'] = QUICK_ACTIONS.map((item) => ({
|
||||
key: item.key,
|
||||
icon: item.icon,
|
||||
@@ -766,27 +913,36 @@ export default function HuyaTasksPage() {
|
||||
const plannedCount = tasks.filter((task) => task.status === 'planned').length;
|
||||
const failedCount = tasks.filter((task) => ['failed', 'error'].includes(task.status)).length;
|
||||
const qrResult = qrTask?.result || null;
|
||||
const qrQueryTask = qrTask ? latestQueryGameTaskByAccount.get(qrTask.account_id) || null : null;
|
||||
const qrQueryResult = qrTask && qrQueryTask && qrQueryTask.id > qrTask.id ? qrQueryTask.result : null;
|
||||
const qrQueryRunning = Boolean(qrQueryTask && qrTask && qrQueryTask.id > qrTask.id && qrQueryTask.status === 'running');
|
||||
const qrQueryFinished = Boolean(qrQueryTask && qrTask && qrQueryTask.id > qrTask.id && qrQueryTask.status !== 'running');
|
||||
const qrImage = resultText(qrResult, 'mini_qrcode_image');
|
||||
const qrBindPhase = resultText(qrResult, 'bind_phase');
|
||||
const qrBindReady = bindReadyForConfirm(qrTask);
|
||||
const qrWaitingRole = qrTask?.status === 'running' && !qrBindReady;
|
||||
const qrGameTitle = resultText(qrResult, 'game_title');
|
||||
const qrRoleName = resultText(qrResult, 'role_name');
|
||||
const qrGameRole = resultObject(qrResult, 'game_role');
|
||||
const qrBindReady = bindReadyForConfirm(qrTask) || Boolean(resultText(qrQueryResult, 'role_name'));
|
||||
const qrRoleSourceResult = resultText(qrQueryResult, 'role_name') ? qrQueryResult : qrResult;
|
||||
const qrWaitingRole = qrQueryRunning;
|
||||
const qrGameTitle = resultText(qrRoleSourceResult, 'game_title');
|
||||
const qrRoleName = resultText(qrRoleSourceResult, 'role_name');
|
||||
const qrGameRole = resultObject(qrRoleSourceResult, 'game_role');
|
||||
const qrRoleArea = typeof qrGameRole?.area_name === 'string' ? qrGameRole.area_name : '';
|
||||
const qrRolePlat = typeof qrGameRole?.plat_name === 'string' ? qrGameRole.plat_name : '';
|
||||
const qrRoleLine = qrBindReady ? [qrRolePlat, qrRoleArea, qrRoleName].filter(Boolean).join(' - ') : '';
|
||||
const qrStatusText = qrBindReady
|
||||
? '已识别角色,待确认'
|
||||
: qrBindPhase === 'role_timeout'
|
||||
? '未检测到角色'
|
||||
: qrBindPhase === 'qrcode_completed'
|
||||
? '等待角色同步'
|
||||
: qrBindPhase === 'qrcode_scanned'
|
||||
? '已扫码'
|
||||
: qrBindPhase === 'qrcode_expired'
|
||||
? '二维码已失效'
|
||||
: '等待绑定';
|
||||
: qrQueryRunning
|
||||
? '查询角色中'
|
||||
: qrQueryFinished
|
||||
? '未检测到角色'
|
||||
: qrBindPhase === 'role_timeout'
|
||||
? '未检测到角色'
|
||||
: qrBindPhase === 'qrcode_completed'
|
||||
? '等待角色同步'
|
||||
: qrBindPhase === 'qrcode_scanned'
|
||||
? '已扫码'
|
||||
: qrBindPhase === 'qrcode_expired'
|
||||
? '二维码已失效'
|
||||
: '等待绑定';
|
||||
const qrAccountName = qrTask
|
||||
? resultProfileNick(qrResult) || qrTask.account_nickname || qrTask.account_uid || `#${qrTask.account_id}`
|
||||
: '';
|
||||
@@ -811,14 +967,21 @@ export default function HuyaTasksPage() {
|
||||
: '';
|
||||
const confirmQrBind = () => {
|
||||
if (!qrTask || !qrBindReady) return;
|
||||
if (batchBusy) {
|
||||
message.warning('当前已有虎牙批次在运行,请先停止或等待结束');
|
||||
return;
|
||||
}
|
||||
const accountId = qrTask.account_id;
|
||||
setQrTask(null);
|
||||
void startTask('confirm_bind', [accountId]);
|
||||
};
|
||||
const queryQrRole = () => {
|
||||
if (!qrTask) return;
|
||||
if (batchBusy) {
|
||||
message.warning('当前已有虎牙批次在运行,请先停止或等待结束');
|
||||
return;
|
||||
}
|
||||
const accountId = qrTask.account_id;
|
||||
setQrTask(null);
|
||||
void startTask('query_game_name', [accountId]);
|
||||
};
|
||||
|
||||
@@ -1090,7 +1253,7 @@ export default function HuyaTasksPage() {
|
||||
}}
|
||||
trigger={['click']}
|
||||
>
|
||||
<Button size="small" icon={<MoreOutlined />} disabled={!canTask || wsConnected} />
|
||||
<Button size="small" icon={<MoreOutlined />} disabled={!canTask || batchBusy || wsConnected} />
|
||||
</Dropdown>
|
||||
);
|
||||
},
|
||||
@@ -1250,7 +1413,16 @@ export default function HuyaTasksPage() {
|
||||
<Button icon={<ReloadOutlined />} onClick={loadAll} loading={loading}>
|
||||
刷新
|
||||
</Button>
|
||||
{batchId && <Tag color="processing">批次 {batchId}</Tag>}
|
||||
{activeBatchId && <Tag color="processing">批次 {activeBatchId}</Tag>}
|
||||
<Button
|
||||
danger
|
||||
icon={<StopOutlined />}
|
||||
disabled={(!activeBatchId && !tasks.some((item) => ['pending', 'running'].includes(item.status))) || !canTask}
|
||||
loading={stopping}
|
||||
onClick={handleStopBatch}
|
||||
>
|
||||
停止
|
||||
</Button>
|
||||
</Space>
|
||||
</div>
|
||||
|
||||
@@ -1290,7 +1462,7 @@ export default function HuyaTasksPage() {
|
||||
size="small"
|
||||
block
|
||||
icon={item.icon}
|
||||
disabled={!canTask || wsConnected}
|
||||
disabled={!canTask || batchBusy || wsConnected}
|
||||
onClick={() => runContextAccountAction(item.key)}
|
||||
style={{ justifyContent: 'flex-start' }}
|
||||
>
|
||||
@@ -1448,7 +1620,7 @@ export default function HuyaTasksPage() {
|
||||
block
|
||||
icon={<PlayCircleOutlined />}
|
||||
loading={starting}
|
||||
disabled={!canTask || selectedIds.length === 0 || wsConnected}
|
||||
disabled={!canTask || selectedIds.length === 0 || batchBusy || wsConnected}
|
||||
onClick={() => startTask()}
|
||||
>
|
||||
创建任务
|
||||
@@ -1461,7 +1633,7 @@ export default function HuyaTasksPage() {
|
||||
<Button
|
||||
icon={item.icon}
|
||||
onClick={() => startTask(item.key)}
|
||||
disabled={!canTask || selectedIds.length === 0 || wsConnected}
|
||||
disabled={!canTask || selectedIds.length === 0 || batchBusy || wsConnected}
|
||||
>
|
||||
{taskTypes[item.key] || item.key}
|
||||
</Button>
|
||||
@@ -1479,7 +1651,7 @@ export default function HuyaTasksPage() {
|
||||
size="small"
|
||||
icon={<ReloadOutlined />}
|
||||
onClick={() => startTask('refresh_goods')}
|
||||
disabled={!canTask || selectedIds.length === 0 || wsConnected}
|
||||
disabled={!canTask || selectedIds.length === 0 || batchBusy || wsConnected}
|
||||
>
|
||||
刷新
|
||||
</Button>
|
||||
@@ -1526,7 +1698,7 @@ export default function HuyaTasksPage() {
|
||||
type="primary"
|
||||
icon={<CheckCircleOutlined />}
|
||||
onClick={() => startTask('exchange_goods')}
|
||||
disabled={!canTask || selectedIds.length === 0 || !selectedExchangeGoodsId || wsConnected}
|
||||
disabled={!canTask || selectedIds.length === 0 || !selectedExchangeGoodsId || batchBusy || wsConnected}
|
||||
>
|
||||
批量兑换商品
|
||||
</Button>
|
||||
@@ -1541,7 +1713,7 @@ export default function HuyaTasksPage() {
|
||||
size="small"
|
||||
icon={<ReloadOutlined />}
|
||||
onClick={() => startTask('refresh_recharge_goods')}
|
||||
disabled={!canTask || selectedIds.length === 0 || wsConnected}
|
||||
disabled={!canTask || selectedIds.length === 0 || batchBusy || wsConnected}
|
||||
>
|
||||
刷新
|
||||
</Button>
|
||||
@@ -1575,7 +1747,7 @@ export default function HuyaTasksPage() {
|
||||
type="primary"
|
||||
icon={<QrcodeOutlined />}
|
||||
onClick={() => startTask('create_recharge_order')}
|
||||
disabled={!canTask || selectedIds.length === 0 || !selectedRechargeGoodsId || wsConnected}
|
||||
disabled={!canTask || selectedIds.length === 0 || !selectedRechargeGoodsId || batchBusy || wsConnected}
|
||||
>
|
||||
生成支付二维码
|
||||
</Button>
|
||||
@@ -1747,7 +1919,7 @@ export default function HuyaTasksPage() {
|
||||
<Space direction="vertical" size={4} style={{ width: '100%', textAlign: 'center' }}>
|
||||
<Text strong>{qrAccountName}</Text>
|
||||
<Tag
|
||||
color={qrBindReady ? 'gold' : qrBindPhase === 'role_timeout' ? 'orange' : 'processing'}
|
||||
color={qrBindReady ? 'gold' : qrBindPhase === 'role_timeout' || qrQueryFinished ? 'orange' : 'processing'}
|
||||
style={{ alignSelf: 'center', marginInlineEnd: 0 }}
|
||||
>
|
||||
{qrStatusText}
|
||||
@@ -1788,7 +1960,7 @@ export default function HuyaTasksPage() {
|
||||
<Button onClick={() => setQrTask(null)}>关闭</Button>
|
||||
<Button
|
||||
icon={<SearchOutlined />}
|
||||
disabled={!canTask || starting || qrWaitingRole}
|
||||
disabled={!canTask || batchBusy || starting || stopping || qrWaitingRole}
|
||||
loading={starting}
|
||||
onClick={queryQrRole}
|
||||
>
|
||||
@@ -1797,7 +1969,7 @@ export default function HuyaTasksPage() {
|
||||
<Button
|
||||
type="primary"
|
||||
icon={<CheckCircleOutlined />}
|
||||
disabled={!qrBindReady || !canTask || starting}
|
||||
disabled={!qrBindReady || !canTask || batchBusy || starting || stopping}
|
||||
loading={starting}
|
||||
onClick={confirmQrBind}
|
||||
>
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import react from '@vitejs/plugin-react'
|
||||
|
||||
const backendTarget = process.env.VITE_BACKEND_TARGET || 'http://127.0.0.1:8000'
|
||||
const backendTarget = process.env.VITE_BACKEND_TARGET || 'http://127.0.0.1:8800'
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
server: {
|
||||
port: 5173,
|
||||
port: 5174,
|
||||
allowedHosts: ["www.u499731.nyat.app"],
|
||||
proxy: {
|
||||
'/api': {
|
||||
|
||||
Reference in New Issue
Block a user