mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-01-23 21:17:30 +00:00
feat: add comprehensive Makefile for project management (#1)
* fix: 修复timeRange=7days时的数据加载和显示问题 ## 修复内容 ### 后端修复 (src/routes/admin.js) - 添加 /admin/usage-costs 接口对 period=7days 的支持 - 实现7天时间范围的成本统计,汇总最近7天的daily数据 - 修复时区处理不一致导致的数据过滤错误 ### 前端修复 (web/admin-spa/src/stores/dashboard.js) - 修改 loadDashboardData() 支持动态 timeRange 参数 - 根据时间范围动态调整 usage-costs 查询参数 - 消除硬编码的 period=today 和 period=all ### 前端修复 (web/admin-spa/src/views/ApiKeysView.vue) - 修正API Key详情统计的period计算逻辑 - 7days时间范围现在正确传递 period=daily 而非 monthly - 确保列表数据和详情统计使用一致的时间范围 ## 解决的问题 - 选择"最近7天"时数据显示不准确或缺失 - API Key详情展开时period参数错误 - 成本统计不跟随时间范围选择变化 - 时区计算不一致导致的边界问题 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> * feat: add comprehensive Makefile for project management - Add common development commands (install, setup, dev, start) - Add frontend build commands (build-web, build-all) - Add service management with daemon support - Add Docker deployment commands - Add CLI management tools shortcuts - Add maintenance and monitoring commands - Include Chinese descriptions for better UX 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -120,13 +120,26 @@ export const useDashboardStore = defineStore('dashboard', () => {
|
||||
}
|
||||
|
||||
// 方法
|
||||
async function loadDashboardData() {
|
||||
async function loadDashboardData(timeRange = null) {
|
||||
loading.value = true
|
||||
try {
|
||||
// 根据timeRange动态设置costs查询参数
|
||||
let costsParams = { today: 'today', all: 'all' }
|
||||
|
||||
if (timeRange) {
|
||||
const periodMapping = {
|
||||
'today': { today: 'today', all: 'today' },
|
||||
'7days': { today: '7days', all: '7days' },
|
||||
'monthly': { today: 'monthly', all: 'monthly' },
|
||||
'all': { today: 'today', all: 'all' }
|
||||
}
|
||||
costsParams = periodMapping[timeRange] || costsParams
|
||||
}
|
||||
|
||||
const [dashboardResponse, todayCostsResponse, totalCostsResponse] = await Promise.all([
|
||||
apiClient.get('/admin/dashboard'),
|
||||
apiClient.get('/admin/usage-costs?period=today'),
|
||||
apiClient.get('/admin/usage-costs?period=all')
|
||||
apiClient.get(`/admin/usage-costs?period=${costsParams.today}`),
|
||||
apiClient.get(`/admin/usage-costs?period=${costsParams.all}`)
|
||||
])
|
||||
|
||||
if (dashboardResponse.success) {
|
||||
|
||||
Reference in New Issue
Block a user