新增 消息定时推送功能
This commit is contained in:
@@ -329,3 +329,37 @@ def api_task_logs(task_id):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"获取任务日志失败: {e}")
|
logger.error(f"获取任务日志失败: {e}")
|
||||||
return jsonify({"success": False, "error": str(e)}), 500
|
return jsonify({"success": False, "error": str(e)}), 500
|
||||||
|
|
||||||
|
|
||||||
|
@message_push_bp.route('/api/statistics', methods=['GET'])
|
||||||
|
@login_required
|
||||||
|
def api_statistics():
|
||||||
|
"""获取任务统计信息API"""
|
||||||
|
try:
|
||||||
|
# 获取任务数据库实例
|
||||||
|
db = current_app.dashboard_server.task_db
|
||||||
|
|
||||||
|
# 获取各种状态的任务数量
|
||||||
|
total = db.get_tasks_count()
|
||||||
|
scheduled = db.get_tasks_count_by_status('scheduled')
|
||||||
|
paused = db.get_tasks_count_by_status('paused')
|
||||||
|
completed = db.get_tasks_count_by_status('completed')
|
||||||
|
failed = db.get_tasks_count_by_status('failed')
|
||||||
|
|
||||||
|
# 获取今日任务数量
|
||||||
|
today = db.get_tasks_count_by_date(datetime.now().strftime('%Y-%m-%d'))
|
||||||
|
|
||||||
|
return jsonify({
|
||||||
|
"success": True,
|
||||||
|
"data": {
|
||||||
|
"total": total,
|
||||||
|
"scheduled": scheduled,
|
||||||
|
"paused": paused,
|
||||||
|
"completed": completed,
|
||||||
|
"failed": failed,
|
||||||
|
"today": today
|
||||||
|
}
|
||||||
|
})
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"获取任务统计信息失败: {e}")
|
||||||
|
return jsonify({"success": False, "error": str(e)}), 500
|
||||||
|
|||||||
Reference in New Issue
Block a user