虎牙自动注册持久化成功流水与批次,支持失败续跑与随时导出

将注册批次/条目/成功记录落库,成功一个写入一条流水;服务中断可恢复并续跑失败项,换电脑也能导出 txt。同时修复 pending 被误判为运行中导致页面卡住的问题。
This commit is contained in:
yml2213
2026-07-12 20:05:04 +08:00
parent c3044dbf69
commit e18b2c6e0c
9 changed files with 1423 additions and 96 deletions
+12
View File
@@ -3,6 +3,7 @@ import type {
HuyaAccountItem,
HuyaAutoRegisterBatch,
HuyaAutoRegisterRequest,
HuyaAutoRegisterRetryRequest,
HuyaConfig,
HuyaCookieItem,
HuyaCookieImportResult,
@@ -13,6 +14,7 @@ import type {
HuyaPasswordLoginResult,
HuyaPasswordLoginSelectedRequest,
HuyaRechargeGoodsItem,
HuyaRegisterSuccessLog,
HuyaSmsCodeRequest,
HuyaSmsCodeResult,
HuyaSmsLoginRequest,
@@ -43,10 +45,20 @@ export const huyaApi = {
api.post<HuyaSmsLoginResult, HuyaSmsLoginResult>('/huya/accounts/sms-login', data, { timeout: 120000 }),
startAutoRegister: (data: HuyaAutoRegisterRequest) =>
api.post<HuyaAutoRegisterBatch, HuyaAutoRegisterBatch>('/huya/register/batches', data),
listAutoRegisterBatches: (limit = 50) =>
api.get<HuyaAutoRegisterBatch[], HuyaAutoRegisterBatch[]>('/huya/register/batches', { params: { limit } }),
getAutoRegisterBatch: (batchId: string) =>
api.get<HuyaAutoRegisterBatch, HuyaAutoRegisterBatch>(`/huya/register/batches/${batchId}`),
stopAutoRegisterBatch: (batchId: string) =>
api.post<MessageResponse, MessageResponse>(`/huya/register/batches/${batchId}/stop`),
retryAutoRegisterBatch: (batchId: string, data?: HuyaAutoRegisterRetryRequest) =>
api.post<HuyaAutoRegisterBatch, HuyaAutoRegisterBatch>(`/huya/register/batches/${batchId}/retry`, data || {}),
exportAutoRegisterBatch: (batchId: string) =>
api.get<Blob, Blob>(`/huya/register/batches/${batchId}/export`, { responseType: 'blob' }),
listRegisterSuccessLogs: (params?: { batch_id?: string; tag?: string; limit?: number }) =>
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 }),
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) =>
+26
View File
@@ -223,6 +223,15 @@ export interface HuyaAutoRegisterRequest {
use_proxy?: boolean;
}
export interface HuyaAutoRegisterRetryRequest {
concurrency?: number;
wait_seconds?: number;
poll_interval?: number;
password_prefix?: string;
fixed_password?: string;
use_proxy?: boolean;
}
export interface HuyaAutoRegisterItem {
line: number;
phone: string;
@@ -267,6 +276,23 @@ export interface HuyaAutoRegisterBatch {
items: HuyaAutoRegisterItem[];
}
export interface HuyaRegisterSuccessLog {
id: number;
batch_id: string;
item_id: number | null;
account_id: number | null;
phone: string;
username: string;
uid: string;
password: string;
sms_url: string;
tag: string;
provider: string;
created_by: number | null;
created_at: string | null;
export_line: string;
}
export interface HuyaPasswordLoginBatchItem {
line: number;
username: string;