虎牙支持先导入账号密码再登录

This commit is contained in:
yml2213
2026-07-05 20:47:16 +08:00
parent 552eb9fa82
commit 2203420146
9 changed files with 493 additions and 73 deletions
+7
View File
@@ -5,8 +5,11 @@ import type {
HuyaCookieItem,
HuyaCookieImportResult,
HuyaGoodsItem,
HuyaPasswordAccountImportResult,
HuyaPasswordLoginBatchResult,
HuyaPasswordLoginRequest,
HuyaPasswordLoginResult,
HuyaPasswordLoginSelectedRequest,
HuyaRechargeGoodsItem,
HuyaTaskBatchRequest,
HuyaTaskBatchResult,
@@ -22,8 +25,12 @@ export const huyaApi = {
api.get<HuyaAccountItem[], HuyaAccountItem[]>('/huya/accounts', { params }),
importCookies: (text: string, tag: string = '') =>
api.post<HuyaCookieImportResult, HuyaCookieImportResult>('/huya/accounts/import-cookies', { text, tag }),
importPasswordAccounts: (text: string, tag: string = '') =>
api.post<HuyaPasswordAccountImportResult, HuyaPasswordAccountImportResult>('/huya/accounts/import-passwords', { text, tag }),
passwordLogin: (data: HuyaPasswordLoginRequest) =>
api.post<HuyaPasswordLoginResult, HuyaPasswordLoginResult>('/huya/accounts/password-login', data),
passwordLoginSelected: (data: HuyaPasswordLoginSelectedRequest) =>
api.post<HuyaPasswordLoginBatchResult, HuyaPasswordLoginBatchResult>('/huya/accounts/password-login/selected', data),
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) =>
+23
View File
@@ -116,6 +116,7 @@ export interface HuyaAccountItem {
uid: string;
yyuid: string;
username: string;
has_password: boolean;
nickname: string;
cookie: string;
cookie_preview: string;
@@ -148,6 +149,28 @@ export interface HuyaPasswordLoginResult extends MessageResponse {
sdid: string;
}
export interface HuyaPasswordLoginBatchItem {
line: number;
username: string;
success: boolean;
message: string;
account?: HuyaAccountItem;
sdid?: string;
}
export interface HuyaPasswordLoginBatchResult extends MessageCountResponse {
failed: number;
results: HuyaPasswordLoginBatchItem[];
}
export interface HuyaPasswordAccountImportResult extends MessageCountResponse {
skipped: number;
}
export interface HuyaPasswordLoginSelectedRequest {
account_ids: number[];
}
export interface HuyaCookieItem {
id: number;
account_id: number;