JobData/app/api/v1/stats.py

13 lines
394 B
Python

from fastapi import APIRouter
from app.core.scheduler import stats_job
stats_router = APIRouter(tags=["统计任务"])
@stats_router.get("/trigger", summary="触发统计并上报(无需鉴权)")
async def trigger_stats():
"""触发一次统计任务并执行上报与邮件通知"""
await stats_job()
return {"code": 200, "message": "统计任务已执行并尝试上报"}