格式化代码
This commit is contained in:
@@ -7,27 +7,32 @@ from flask import current_app
|
||||
# 创建统计数据蓝图
|
||||
stats_bp = Blueprint('stats', __name__)
|
||||
|
||||
|
||||
# 页面路由
|
||||
@stats_bp.route('/plugins')
|
||||
@login_required
|
||||
def plugins():
|
||||
return render_template('plugins.html')
|
||||
|
||||
|
||||
@stats_bp.route('/users')
|
||||
@login_required
|
||||
def users_page():
|
||||
return render_template('users.html')
|
||||
|
||||
|
||||
@stats_bp.route('/groups')
|
||||
@login_required
|
||||
def groups():
|
||||
return render_template('groups.html')
|
||||
|
||||
|
||||
@stats_bp.route('/errors')
|
||||
@login_required
|
||||
def errors():
|
||||
return render_template('errors.html')
|
||||
|
||||
|
||||
# API路由
|
||||
@stats_bp.route('/api/user_stats')
|
||||
@login_required
|
||||
@@ -49,6 +54,7 @@ def api_user_stats():
|
||||
logger.error(f"获取用户统计失败: {e}")
|
||||
return jsonify({"success": False, "error": str(e)}), 500
|
||||
|
||||
|
||||
@stats_bp.route('/api/group_stats')
|
||||
@login_required
|
||||
def api_group_stats():
|
||||
@@ -69,6 +75,7 @@ def api_group_stats():
|
||||
logger.error(f"获取群组统计失败: {e}")
|
||||
return jsonify({"success": False, "error": str(e)}), 500
|
||||
|
||||
|
||||
@stats_bp.route('/api/plugin_stats')
|
||||
@login_required
|
||||
def api_plugin_stats():
|
||||
@@ -81,6 +88,7 @@ def api_plugin_stats():
|
||||
logger.error(f"获取插件统计失败: {e}")
|
||||
return jsonify({"success": False, "error": str(e)}), 500
|
||||
|
||||
|
||||
@stats_bp.route('/api/error_logs')
|
||||
@login_required
|
||||
def api_error_logs():
|
||||
@@ -94,6 +102,7 @@ def api_error_logs():
|
||||
logger.error(f"获取错误日志失败: {e}")
|
||||
return jsonify({"success": False, "error": str(e)}), 500
|
||||
|
||||
|
||||
@stats_bp.route('/api/dashboard_summary')
|
||||
@login_required
|
||||
def api_dashboard_summary():
|
||||
@@ -118,6 +127,7 @@ def api_dashboard_summary():
|
||||
logger.error(f"获取仪表盘摘要数据出错: {e}")
|
||||
return jsonify({"success": False, "error": str(e)}), 500
|
||||
|
||||
|
||||
@stats_bp.route('/api/plugin_trend')
|
||||
@login_required
|
||||
def api_plugin_trend():
|
||||
@@ -131,6 +141,7 @@ def api_plugin_trend():
|
||||
logger.error(f"获取插件趋势失败: {e}")
|
||||
return jsonify({"success": False, "error": str(e)}), 500
|
||||
|
||||
|
||||
@stats_bp.route('/api/error_detail/<int:error_id>')
|
||||
@login_required
|
||||
def api_error_detail(error_id):
|
||||
@@ -140,4 +151,4 @@ def api_error_detail(error_id):
|
||||
return jsonify({"success": True, "data": detail})
|
||||
except Exception as e:
|
||||
logger.error(f"获取错误详情失败: {e}")
|
||||
return jsonify({"success": False, "error": str(e)}), 500
|
||||
return jsonify({"success": False, "error": str(e)}), 500
|
||||
|
||||
Reference in New Issue
Block a user