fix(server): lower date backtrack limit from 90 to 31 days

Aneng only supports querying data up to 31 days back. The previous
90-day cap allowed dates that would silently fail at download time,
so restrict the POST /tasks `date` validation to a 31-day window.
This commit is contained in:
Misaka_Company
2026-07-29 16:55:14 +08:00
parent 5e2ef72afd
commit 4f0ef69739

View File

@@ -216,9 +216,9 @@ def create_task(req: TaskRequest):
raise HTTPException( raise HTTPException(
status_code=400, detail=f"date 不可为未来日期: {req.date}" status_code=400, detail=f"date 不可为未来日期: {req.date}"
) )
if target_date < today - timedelta(days=90): if target_date < today - timedelta(days=31):
raise HTTPException( raise HTTPException(
status_code=400, detail=f"date 超出 90 天回溯上限: {req.date}" status_code=400, detail=f"date 超出 31 天回溯上限: {req.date}"
) )
if req.site == "百世": if req.site == "百世":
raise HTTPException( raise HTTPException(