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获取所有断面数据