fix(system): fix timezone handling in dashboard and stats services

- Use app timezone instead of UTC for date calculations in dashboard routes
- Ensure consistency between stats_daily.date and timezone-aware comparisons
- Fix date calculations in cleanup scheduler to handle DST correctly
- Update log message in stats aggregator to use business date
This commit is contained in:
fawney19
2025-12-13 23:50:59 +08:00
parent 7d0003e61e
commit 2f9d943647
3 changed files with 71 additions and 38 deletions

View File

@@ -194,7 +194,8 @@ class StatsAggregatorService:
db.add(stats)
db.commit()
logger.info(f"[StatsAggregator] 聚合日期 {day_start.date()} 完成: {total_requests} 请求")
# 日志使用业务日期(输入参数),而不是 UTC 日期
logger.info(f"[StatsAggregator] 聚合日期 {date.date()} 完成: {total_requests} 请求")
return stats
@staticmethod