perf(account-check): 优化账号检测首屏加载

This commit is contained in:
yml
2026-11-22 17:05:10 +08:00
parent 7233bdfa50
commit 22e106bf9b
9 changed files with 421 additions and 150 deletions
+10 -2
View File
@@ -3,11 +3,13 @@ import type {
DouyuAccountProtectionTarget,
DouyuAccountProtectionTargetUpdate,
DouyuAccountPlatformStatus,
DouyuPlatformTrendsResponse,
DouyuConfig,
DouyuExchangeResultImage,
DouyuGoodsItem,
DouyuRechargeChannel,
DouyuSupplyTarget,
DouyuSupplyTargetConfig,
DouyuSupplyTargetUpdate,
DouyuSupplyTargetUpsert,
DouyuTaskAccountItem,
@@ -22,8 +24,12 @@ 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'),
getAccountPlatformStatus: (includeTrends = true) =>
api.get<DouyuAccountPlatformStatus, DouyuAccountPlatformStatus>('/douyu/account-platform-status', {
params: { include_trends: includeTrends },
}),
getAccountPlatformTrends: () =>
api.get<DouyuPlatformTrendsResponse, DouyuPlatformTrendsResponse>('/douyu/account-platform-trends'),
updateAccountProtectionTarget: (
groupKey: DouyuAccountProtectionTarget['group_key'],
data: DouyuAccountProtectionTargetUpdate,
@@ -34,6 +40,8 @@ export const douyuApi = {
),
listSupplyTargets: () =>
api.get<DouyuSupplyTarget[], DouyuSupplyTarget[]>('/douyu/supply-targets'),
listSupplyTargetConfigs: () =>
api.get<DouyuSupplyTargetConfig[], DouyuSupplyTargetConfig[]>('/douyu/supply-targets/config'),
createSupplyTarget: (data: DouyuSupplyTargetUpsert) =>
api.post<DouyuSupplyTarget, DouyuSupplyTarget>('/douyu/supply-targets', data),
updateSupplyTarget: (targetId: number, data: DouyuSupplyTargetUpdate) =>
+22 -1
View File
@@ -745,6 +745,22 @@ export interface DouyuSupplyTargetStatus {
needs_replenishment: boolean;
}
export interface DouyuSupplyTargetConfig {
id: number;
target_id: number;
platform: string;
scope: string;
commodity_id: string;
value_class: 'high_value' | 'ordinary';
target_covered: number;
target_available: number;
target_allocatable: number;
safety_buffer: number;
enabled: boolean;
updated_by: number | null;
updated_at: string | null;
}
export interface DouyuSupplyTarget extends DouyuSupplyTargetStatus {
platform: string;
enabled: boolean;
@@ -859,6 +875,11 @@ export interface DouyuPlatformTrends {
lifecycle: DouyuLifecycleTrendDay[];
}
export interface DouyuPlatformTrendsResponse {
trends: DouyuPlatformTrends;
alerts: DouyuPlatformAlert[];
}
export interface DouyuAccountPlatformStatus {
checked_at: string;
accounts: {
@@ -882,7 +903,7 @@ export interface DouyuAccountPlatformStatus {
protection_targets: DouyuAccountProtectionTarget[];
supply_targets: DouyuSupplyTargetStatus[];
alerts: DouyuPlatformAlert[];
trends: DouyuPlatformTrends;
trends: DouyuPlatformTrends | null;
}
export interface DouyuConfig {