luojunhui 12 hours ago
parent
commit
db815b2dd9
3 changed files with 5 additions and 4 deletions
  1. 2 2
      applications/service/response.py
  2. 2 1
      routes/blueprint.py
  3. 1 1
      tasks/task_scheduler.py

+ 2 - 2
applications/service/response.py

@@ -15,5 +15,5 @@ class TaskScheduleResponse:
         return {"code": error_code, "status": "error", "message": error_message}
 
     @classmethod
-    async def success_response(cls, data):
-        return {"code": 0, "status": "task execute successfully", "data": data}
+    async def success_response(cls, task_name,  data):
+        return {"code": 0, "status": "task execute successfully", "data": data, "task_name": task_name}

+ 2 - 1
routes/blueprint.py

@@ -18,6 +18,7 @@ def server_routes(pools):
     async def run_task():
         data = await request.get_json()
         task_scheduler = TaskScheduler(data)
-        return jsonify(await task_scheduler.deal())
+        response = await task_scheduler.deal()
+        return jsonify(response)
 
     return server_blueprint

+ 1 - 1
tasks/task_scheduler.py

@@ -17,7 +17,7 @@ class TaskScheduler:
         match task_name:
             case "check_kimi_balance":
                 response = await check_kimi_balance()
-                return task_schedule_response.success_response(response)
+                return await task_schedule_response.success_response(task_name=task_name, data=response)
             case _:
                 return await task_schedule_response.fail_response(
                     error_code="4001",