feat(douyu): 增加账号供给看板与阈值告警

This commit is contained in:
yml
2026-11-21 22:55:42 +08:00
parent 1e2089431d
commit f5d81a65ce
11 changed files with 413 additions and 18 deletions
+3
View File
@@ -1,5 +1,6 @@
import api from './client';
import type {
DouyuAccountPlatformStatus,
DouyuConfig,
DouyuExchangeResultImage,
DouyuGoodsItem,
@@ -16,6 +17,8 @@ import type {
export const douyuApi = {
taskTypes: () => api.get<Record<string, string>, Record<string, string>>('/douyu/task-types'),
getAccountPlatformStatus: () =>
api.get<DouyuAccountPlatformStatus, DouyuAccountPlatformStatus>('/douyu/account-platform-status'),
listAccounts: (params?: { search?: string; tag?: string; ids?: string }) =>
api.get<DouyuTaskAccountItem[], DouyuTaskAccountItem[]>('/douyu/accounts', { params }),
listAccountsPaged: (params: PageParams & { ids?: string; tag?: string }) =>
+53
View File
@@ -727,6 +727,59 @@ export interface DouyuTaskAccountItem {
assigned_username: string | null;
}
export interface DouyuSupplyTargetStatus {
target_id: number;
scope: string;
commodity_id: string;
value_class: 'high_value' | 'ordinary';
target_covered: number;
target_available: number;
target_allocatable: number;
safety_buffer: number;
covered: number;
available: number;
allocatable: number;
covered_shortage: number;
available_shortage: number;
allocatable_shortage: number;
needs_replenishment: boolean;
}
export interface DouyuPlatformAlert {
code: string;
severity: 'critical' | 'warning' | 'info';
message: string;
scope?: string;
commodity_id?: string;
value_class?: string;
shortage?: number;
count?: number;
}
export interface DouyuAccountPlatformStatus {
checked_at: string;
accounts: {
total: number;
with_cookie: number;
ck_valid: number;
ck_invalid: number;
ck_error: number;
ck_unchecked: number;
ck_expiring_24h: number;
ck_expiring_72h: number;
ck_predicted_expired: number;
};
work_queue: Record<string, Record<string, number | string | null>>;
sync_domains: Record<string, Record<string, number>>;
commodities: {
by_availability: Record<string, { total: number; fresh: number }>;
fresh_available: number;
fresh_limited: number;
};
supply_targets: DouyuSupplyTargetStatus[];
alerts: DouyuPlatformAlert[];
}
export interface DouyuConfig {
manual_id: string;
rid: string;