From 92ec3ffc727356bf3e6f6b1156372d56db110d48 Mon Sep 17 00:00:00 2001 From: Edric Li Date: Sun, 7 Sep 2025 21:59:44 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20API=20Keys=E9=A1=B5=E9=9D=A2=E6=81=A2?= =?UTF-8?q?=E5=A4=8D=E4=BB=8A=E6=97=A5=E6=97=B6=E9=97=B4=E9=80=89=E9=A1=B9?= =?UTF-8?q?=E5=B9=B6=E8=AE=BE=E4=B8=BA=E9=BB=98=E8=AE=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加"今日"时间筛选选项,使用fa-calendar-day图标 - 将默认时间范围从"最近7天"改为"今日" - 优化日期处理逻辑,确保今日选项从0点开始 - 调整UsageDetailModal宽度以适应内容显示 - 同步更新所有相关的初始化和重置逻辑 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- src/routes/admin.js | 18 ++++++------ .../components/apikeys/UsageDetailModal.vue | 2 +- web/admin-spa/src/views/ApiKeysView.vue | 28 +++++++++++-------- 3 files changed, 26 insertions(+), 22 deletions(-) diff --git a/src/routes/admin.js b/src/routes/admin.js index 49000f8f..e6a960b7 100644 --- a/src/routes/admin.js +++ b/src/routes/admin.js @@ -143,10 +143,10 @@ router.get('/api-keys', authenticateAdmin, async (req, res) => { return res.status(400).json({ error: 'Start date must be before or equal to end date' }) } - // 限制最大范围为31天 + // 限制最大范围为365天 const daysDiff = Math.ceil((end - start) / (1000 * 60 * 60 * 24)) + 1 - if (daysDiff > 31) { - return res.status(400).json({ error: 'Date range cannot exceed 31 days' }) + if (daysDiff > 365) { + return res.status(400).json({ error: 'Date range cannot exceed 365 days' }) } // 生成日期范围内每天的搜索模式 @@ -3916,10 +3916,10 @@ router.get('/model-stats', authenticateAdmin, async (req, res) => { return res.status(400).json({ error: 'Start date must be before or equal to end date' }) } - // 限制最大范围为31天 + // 限制最大范围为365天 const daysDiff = Math.ceil((end - start) / (1000 * 60 * 60 * 24)) + 1 - if (daysDiff > 31) { - return res.status(400).json({ error: 'Date range cannot exceed 31 days' }) + if (daysDiff > 365) { + return res.status(400).json({ error: 'Date range cannot exceed 365 days' }) } // 生成日期范围内所有日期的搜索模式 @@ -4380,10 +4380,10 @@ router.get('/api-keys/:keyId/model-stats', authenticateAdmin, async (req, res) = return res.status(400).json({ error: 'Start date must be before or equal to end date' }) } - // 限制最大范围为31天 + // 限制最大范围为365天 const daysDiff = Math.ceil((end - start) / (1000 * 60 * 60 * 24)) + 1 - if (daysDiff > 31) { - return res.status(400).json({ error: 'Date range cannot exceed 31 days' }) + if (daysDiff > 365) { + return res.status(400).json({ error: 'Date range cannot exceed 365 days' }) } // 生成日期范围内所有日期的搜索模式 diff --git a/web/admin-spa/src/components/apikeys/UsageDetailModal.vue b/web/admin-spa/src/components/apikeys/UsageDetailModal.vue index 54593e11..93527223 100644 --- a/web/admin-spa/src/components/apikeys/UsageDetailModal.vue +++ b/web/admin-spa/src/components/apikeys/UsageDetailModal.vue @@ -6,7 +6,7 @@