feat: initialize new React application structure with TypeScript, ESLint, and Prettier configurations, while removing legacy files and adding new components and pages for enhanced functionality

This commit is contained in:
Supra4E8C
2025-12-07 11:32:31 +08:00
parent 8e4132200d
commit 450964fb1a
144 changed files with 14223 additions and 21647 deletions

25
src/services/api/usage.ts Normal file
View File

@@ -0,0 +1,25 @@
/**
* 使用统计相关 API
*/
import { apiClient } from './client';
import { computeKeyStats, KeyStats } from '@/utils/usage';
export const usageApi = {
/**
* 获取使用统计原始数据
*/
getUsage: () => apiClient.get('/usage'),
/**
* 计算密钥成功/失败统计,必要时会先获取 usage 数据
*/
async getKeyStats(usageData?: any): Promise<KeyStats> {
let payload = usageData;
if (!payload) {
const response = await apiClient.get('/usage');
payload = response?.usage ?? response;
}
return computeKeyStats(payload);
}
};