新增斗鱼活动任务模块:绑定、宝典、鱼翅、积分、兑换等功能
- 新增 activity_client.py:封装斗鱼活动/兑换/充值/送礼接口 - 新增 cookie_utils.py:Cookie 解析与规范化工具 - 新增 douyu_service/douyu_runner:斗鱼任务服务层与批量执行器 - 新增 douyu 路由:任务类型查询、账号列表、配置管理、商品管理、批量任务、WebSocket 日志 - 新增 models/schemas:DouyuTask/DouyuConfig/DouyuGoodsSnapshot 模型,Account 扩展点数/鱼翅/绑定状态等字段 - 新增数据库迁移:斗鱼活动相关表与 accounts 字段补充 - 新增前端 DouyuTasksPage 任务操作台页面 - 兑换商品请求添加 sec-ch-ua 反检测头 - 兑换商品支持最多 8 次重试 + csrf_token 自动刷新 - 注册 douyu:task / douyu:config 权限点 - 侧边栏新增斗鱼分组与任务操作台菜单入口
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import api from './client';
|
||||
import type {
|
||||
DouyuConfig,
|
||||
DouyuGoodsItem,
|
||||
DouyuTaskAccountItem,
|
||||
DouyuTaskBatchRequest,
|
||||
DouyuTaskBatchResult,
|
||||
DouyuTaskItem,
|
||||
MessageResponse,
|
||||
} from './types';
|
||||
|
||||
export const douyuApi = {
|
||||
taskTypes: () => api.get<Record<string, string>, Record<string, string>>('/douyu/task-types'),
|
||||
listAccounts: (params?: { search?: string }) =>
|
||||
api.get<DouyuTaskAccountItem[], DouyuTaskAccountItem[]>('/douyu/accounts', { params }),
|
||||
getConfig: () => api.get<DouyuConfig, DouyuConfig>('/douyu/config'),
|
||||
updateConfig: (data: Partial<DouyuConfig>) => api.put<DouyuConfig, DouyuConfig>('/douyu/config', data),
|
||||
listGoods: () => api.get<DouyuGoodsItem[], DouyuGoodsItem[]>('/douyu/goods'),
|
||||
createTasks: (data: DouyuTaskBatchRequest) =>
|
||||
api.post<DouyuTaskBatchResult, DouyuTaskBatchResult>('/douyu/tasks/batch', data),
|
||||
listTasks: (batchId?: string) =>
|
||||
api.get<DouyuTaskItem[], DouyuTaskItem[]>('/douyu/tasks', { params: batchId ? { batch_id: batchId } : {} }),
|
||||
getTask: (taskId: number) => api.get<DouyuTaskItem, DouyuTaskItem>(`/douyu/tasks/${taskId}`),
|
||||
stopBatch: (batchId: string) => api.post<MessageResponse, MessageResponse>(`/douyu/stop/${batchId}`),
|
||||
};
|
||||
@@ -4,6 +4,7 @@ export { accountApi } from './accounts';
|
||||
export { appApi } from './app';
|
||||
export { authApi } from './auth';
|
||||
export { cookieApi } from './cookies';
|
||||
export { douyuApi } from './douyu';
|
||||
export { huyaApi } from './huya';
|
||||
export { loginApi } from './login';
|
||||
export { proxyApi } from './proxy';
|
||||
|
||||
@@ -168,6 +168,78 @@ export interface CookieItem {
|
||||
account_password: string;
|
||||
}
|
||||
|
||||
// ==================== Douyu Activity ====================
|
||||
|
||||
export interface DouyuTaskAccountItem {
|
||||
id: number;
|
||||
username: string;
|
||||
uid: string;
|
||||
nickname: string;
|
||||
tag: string;
|
||||
points: number | null;
|
||||
game_name: string;
|
||||
game_channel: string;
|
||||
gold_balance: number | null;
|
||||
exchange_balance: number | null;
|
||||
bind_status: string;
|
||||
change_role_wait_time: number | null;
|
||||
assigned_to: number | null;
|
||||
assigned_username: string | null;
|
||||
}
|
||||
|
||||
export interface DouyuConfig {
|
||||
manual_id: string;
|
||||
rid: string;
|
||||
bind_act_alias: string;
|
||||
confirm_act_alias: string;
|
||||
legacy_act_alias: string;
|
||||
room_id: string;
|
||||
elite_amount: number;
|
||||
gold_pay_type: number;
|
||||
gift_id: string;
|
||||
skin_id: string;
|
||||
updated_at: string | null;
|
||||
}
|
||||
|
||||
export interface DouyuTaskBatchRequest {
|
||||
account_ids: number[];
|
||||
task_type: string;
|
||||
concurrency?: number;
|
||||
payload?: Record<string, unknown>;
|
||||
}
|
||||
|
||||
export interface DouyuTaskBatchResult {
|
||||
batch_id: string;
|
||||
count: number;
|
||||
success: boolean;
|
||||
}
|
||||
|
||||
export interface DouyuTaskItem {
|
||||
id: number;
|
||||
batch_id: string;
|
||||
account_id: number;
|
||||
account_username: string;
|
||||
account_uid: string;
|
||||
account_nickname: string;
|
||||
task_type: string;
|
||||
status: string;
|
||||
message: string;
|
||||
result: Record<string, unknown> | null;
|
||||
created_by: number;
|
||||
created_at: string | null;
|
||||
finished_at: string | null;
|
||||
}
|
||||
|
||||
export interface DouyuGoodsItem {
|
||||
id: number;
|
||||
commodity_id: string;
|
||||
name: string;
|
||||
score: number | null;
|
||||
status: string;
|
||||
raw: Record<string, unknown> | null;
|
||||
updated_at: string | null;
|
||||
}
|
||||
|
||||
// ==================== Huya ====================
|
||||
|
||||
export interface HuyaAccountItem {
|
||||
|
||||
Reference in New Issue
Block a user