加入周期任务里面的每个周期的具体时间
This commit is contained in:
@@ -85,9 +85,19 @@ def message_push_management():
|
||||
@message_push_bp.route('/api/tasks', methods=['GET'])
|
||||
@login_required
|
||||
def api_tasks_list():
|
||||
"""获取任务列表"""
|
||||
"""获取任务列表API"""
|
||||
try:
|
||||
tasks = task_db.get_all_tasks()
|
||||
# 获取查询参数
|
||||
status = request.args.get('status')
|
||||
start_time = request.args.get('start_time')
|
||||
end_time = request.args.get('end_time')
|
||||
page = int(request.args.get('page', 1))
|
||||
limit = int(request.args.get('limit', 20))
|
||||
|
||||
# 获取任务列表
|
||||
db = current_app.dashboard_server.task_db
|
||||
tasks, total = db.get_tasks_list(status, start_time, end_time, page, limit)
|
||||
|
||||
# 处理任务数据,确保所有字段都可以JSON序列化
|
||||
serialized_tasks = []
|
||||
for task in tasks:
|
||||
@@ -111,15 +121,21 @@ def api_tasks_list():
|
||||
except:
|
||||
task_dict['weekly_days'] = None
|
||||
serialized_tasks.append(task_dict)
|
||||
|
||||
return jsonify({
|
||||
'success': True,
|
||||
'data': serialized_tasks
|
||||
"success": True,
|
||||
"data": {
|
||||
"tasks": serialized_tasks,
|
||||
"total": total,
|
||||
"page": page,
|
||||
"limit": limit
|
||||
}
|
||||
})
|
||||
except Exception as e:
|
||||
logger.error(f"获取任务列表失败: {str(e)}")
|
||||
return jsonify({
|
||||
'success': False,
|
||||
'message': f'获取任务列表失败: {str(e)}'
|
||||
"success": False,
|
||||
"message": f'获取任务列表失败: {str(e)}'
|
||||
}), 500
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user