From eb8e60786902a8ccb9c298418e1bba733bb82c7a Mon Sep 17 00:00:00 2001 From: whm <973418690@qq.com> Date: Sat, 15 Nov 2025 15:35:55 +0800 Subject: [PATCH] =?UTF-8?q?1.=E6=AF=8F=E6=97=A5=E6=95=B0=E6=8D=AE=E6=89=8B?= =?UTF-8?q?=E5=8A=A8=E5=86=99=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/comprehensive_data.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/app/api/comprehensive_data.py b/app/api/comprehensive_data.py index af42e53..7226d48 100644 --- a/app/api/comprehensive_data.py +++ b/app/api/comprehensive_data.py @@ -478,24 +478,16 @@ def get_today_data(request: TodayDataRequest, db: Session = Depends(get_db)): def refresh_today_data(request: TodayDataRequest, db: Session = Depends(get_db)): """接口:通过POST请求触发调度器中的 scheduled_get_max_nyid_by_point_id 定时任务""" try: - # 获取请求参数(如果需要从请求体中接收参数,可通过request获取) - # 示例:如需接收account_id,可通过 request.account_id 获取 - # account_id = request.account_id # 根据根据实际需求决定是否需要 - - # 触发定时任务(如果需要传入参数,可在这里添加) from ..utils.scheduler import scheduled_get_max_nyid_by_point_id scheduled_get_max_nyid_by_point_id() - - # 调用服务层获取数据 account_id = request.account_id daily_service = DailyDataService() - # 如需使用请求参数,可修改为 daily_service.get_daily_data_by_account(db, account_id=account_id) daily_data = daily_service.get_daily_data_by_account(db, account_id=account_id) return DataResponse( code=ResponseCode.SUCCESS, message="定时时任务触发执行成功!任务已开始处理(具体结果查看系统日志)", - total=1 if daily_data else 0, # 根据实际数据是否存在调整total + total=len(daily_data), # 根据实际数据是否存在调整total data=daily_data ) except Exception as e: @@ -503,7 +495,7 @@ def refresh_today_data(request: TodayDataRequest, db: Session = Depends(get_db)) return DataResponse( code=ResponseCode.QUERY_FAILED, message=f"定时任务触发失败:{str(e)}", - total=0, + total=len(daily_data), data={} ) # account_id获取所有断面数据