feat: API Keys页面恢复今日时间选项并设为默认

- 添加"今日"时间筛选选项,使用fa-calendar-day图标
- 将默认时间范围从"最近7天"改为"今日"
- 优化日期处理逻辑,确保今日选项从0点开始
- 调整UsageDetailModal宽度以适应内容显示
- 同步更新所有相关的初始化和重置逻辑

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Edric Li
2025-09-07 21:59:44 +08:00
parent 8c9d6381f3
commit 92ec3ffc72
3 changed files with 26 additions and 22 deletions

View File

@@ -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' })
}
// 生成日期范围内所有日期的搜索模式