fix: 后端 API 修复

- deps.py: 依赖注入优化
- matches.py: 比赛列表查询修复
- predict.py: 预测接口参数校验修复
- orchestrator.py: 多 Agent 编排逻辑修复
This commit is contained in:
shangfangjian
2026-09-20 08:45:19 +08:00
parent 8e6ad5394e
commit 7b1457f0db
4 changed files with 19 additions and 8 deletions
+7 -1
View File
@@ -72,7 +72,13 @@ async def list_matches(
d = datetime.strptime(date, "%Y-%m-%d")
except ValueError:
raise HTTPException(400, "date 格式应为 YYYY-MM-DD")
q = q.where(Match.match_date >= d, Match.match_date < d + timedelta(days=1))
# date 是用户本地日期(默认北京 UTC+8);match_date 存 UTC,需转换:
# 本地 00:00 (UTC+8) = UTC 前一天 16:00;本地 24:00 = UTC 当天 16:00
from datetime import timezone as tz_mod
tz_cn = tz_mod(timedelta(hours=8))
local_start = d.replace(tzinfo=tz_cn)
local_end = local_start + timedelta(days=1)
q = q.where(Match.match_date >= local_start, Match.match_date < local_end)
# 未开赛按日期正序(最近的排最前,便于预测);其余按日期倒序(最新赛果在前)
if status == "scheduled":