优化任务列表性能和本地登录代理

This commit is contained in:
yml2213
2026-08-05 10:03:18 +08:00
parent dff0d7db9e
commit 2fda47c631
13 changed files with 252 additions and 29 deletions
+2
View File
@@ -31,6 +31,7 @@ import type {
MessageResponse,
PageParams,
PaginatedResponse,
TaskSummary,
} from './types';
export const huyaApi = {
@@ -108,6 +109,7 @@ export const huyaApi = {
// 列表轮询默认不带 base64 小程序码,避免每次 1MB+ 流量。
params: batchId ? { batch_id: batchId, include_images: false } : { include_images: false },
}),
tasksSummary: () => api.get<TaskSummary, TaskSummary>('/huya/tasks/summary'),
getTask: (taskId: number) =>
api.get<HuyaTaskItem, HuyaTaskItem>(`/huya/tasks/${taskId}`),
};
+2 -1
View File
@@ -1,5 +1,5 @@
import api from './client';
import type { BatchLoginResult, LoginTaskItem, MessageDeletedResponse, MessageResponse } from './types';
import type { BatchLoginResult, LoginTaskItem, MessageDeletedResponse, MessageResponse, TaskSummary } from './types';
interface CreateBatchParams {
account_ids: number[];
@@ -15,6 +15,7 @@ export const loginApi = {
api.post<BatchLoginResult, BatchLoginResult>('/login/batch', params),
listTasks: (batch_id?: string) =>
api.get<LoginTaskItem[], LoginTaskItem[]>('/login/tasks', { params: batch_id ? { batch_id } : {} }),
tasksSummary: () => api.get<TaskSummary, TaskSummary>('/login/tasks/summary'),
stop: (batch_id: string) => api.post<MessageResponse, MessageResponse>(`/login/stop/${batch_id}`),
deleteTask: (id: number) => api.delete<MessageResponse, MessageResponse>(`/login/tasks/${id}`),
deleteTasks: (ids: number[]) => api.delete<MessageDeletedResponse, MessageDeletedResponse>(`/login/tasks`, { params: { task_ids: ids.join(',') } }),
+7
View File
@@ -50,6 +50,13 @@ export interface BasicSummary {
tag_count?: number;
}
export interface TaskSummary {
total: number;
success: number;
failed: number;
status_counts: Record<string, number>;
}
// ==================== Auth ====================
export interface LoginResult {