fix: 修复订阅窗口过期后进度条显示不正确的问题
问题:滑动窗口过期后(如昨天用满额度),前端仍显示历史数据(红色进度条100%、"即将重置") 解决: - 后端返回数据前检查窗口是否过期,过期则清零展示数据 - 前端处理 window_start 为 null 的情况,显示"窗口未激活" - 不影响实际的窗口激活逻辑,窗口仍从当天零点开始
This commit is contained in:
@@ -592,6 +592,8 @@ const getProgressClass = (used: number, limit: number | null): string => {
|
||||
|
||||
// Format reset time based on window start and period type
|
||||
const formatResetTime = (windowStart: string, period: 'daily' | 'weekly' | 'monthly'): string => {
|
||||
if (!windowStart) return t('admin.subscriptions.windowNotActive')
|
||||
|
||||
const start = new Date(windowStart)
|
||||
const now = new Date()
|
||||
|
||||
@@ -610,7 +612,7 @@ const formatResetTime = (windowStart: string, period: 'daily' | 'weekly' | 'mont
|
||||
}
|
||||
|
||||
const diffMs = resetTime.getTime() - now.getTime()
|
||||
if (diffMs <= 0) return t('admin.subscriptions.resetNow')
|
||||
if (diffMs <= 0) return t('admin.subscriptions.windowNotActive')
|
||||
|
||||
const diffSeconds = Math.floor(diffMs / 1000)
|
||||
const days = Math.floor(diffSeconds / 86400)
|
||||
|
||||
Reference in New Issue
Block a user