73 lines
1.7 KiB
TypeScript
73 lines
1.7 KiB
TypeScript
/**
|
|
* 龙虎榜配置服务
|
|
* 负责龙虎榜配置的API调用
|
|
*/
|
|
|
|
import apiClient from '@/infrastructure/api/client';
|
|
import { API_ENDPOINTS } from '@/infrastructure/api/endpoints';
|
|
|
|
/** 龙虎榜配置 */
|
|
export interface LeaderboardConfig {
|
|
id: string;
|
|
configKey: string;
|
|
dailyEnabled: boolean;
|
|
weeklyEnabled: boolean;
|
|
monthlyEnabled: boolean;
|
|
virtualRankingEnabled: boolean;
|
|
virtualAccountCount: number;
|
|
displayLimit: number;
|
|
refreshIntervalMinutes: number;
|
|
}
|
|
|
|
/** 更新榜单开关请求 */
|
|
export interface UpdateLeaderboardSwitchRequest {
|
|
type: 'daily' | 'weekly' | 'monthly';
|
|
enabled: boolean;
|
|
}
|
|
|
|
/** 更新虚拟排名设置请求 */
|
|
export interface UpdateVirtualRankingRequest {
|
|
enabled: boolean;
|
|
accountCount: number;
|
|
}
|
|
|
|
/** 更新显示设置请求 */
|
|
export interface UpdateDisplaySettingsRequest {
|
|
displayLimit: number;
|
|
}
|
|
|
|
/**
|
|
* 龙虎榜配置服务
|
|
*/
|
|
export const leaderboardService = {
|
|
/**
|
|
* 获取榜单配置
|
|
*/
|
|
async getConfig(): Promise<LeaderboardConfig> {
|
|
return apiClient.get(API_ENDPOINTS.LEADERBOARD.CONFIG);
|
|
},
|
|
|
|
/**
|
|
* 更新榜单开关
|
|
*/
|
|
async updateSwitch(request: UpdateLeaderboardSwitchRequest): Promise<void> {
|
|
return apiClient.put(API_ENDPOINTS.LEADERBOARD.CONFIG_SWITCH, request);
|
|
},
|
|
|
|
/**
|
|
* 更新虚拟排名设置
|
|
*/
|
|
async updateVirtualRanking(request: UpdateVirtualRankingRequest): Promise<void> {
|
|
return apiClient.put(API_ENDPOINTS.LEADERBOARD.CONFIG_VIRTUAL, request);
|
|
},
|
|
|
|
/**
|
|
* 更新显示设置
|
|
*/
|
|
async updateDisplaySettings(request: UpdateDisplaySettingsRequest): Promise<void> {
|
|
return apiClient.put(API_ENDPOINTS.LEADERBOARD.CONFIG_DISPLAY, request);
|
|
},
|
|
};
|
|
|
|
export default leaderboardService;
|