From 9a392f62b069437ad0c401255b79a1c17b164144 Mon Sep 17 00:00:00 2001 From: Codex Agent Date: Mon, 24 Nov 2025 15:18:49 +0800 Subject: [PATCH] feat: add super admin v2 debug console --- lawrisk/api/v2.py | 15 +- static/v2_admin_debug.html | 1014 ++++++++++++++++++++++++++++++++++++ 2 files changed, 1027 insertions(+), 2 deletions(-) create mode 100644 static/v2_admin_debug.html diff --git a/lawrisk/api/v2.py b/lawrisk/api/v2.py index ff47539..06c0c1c 100644 --- a/lawrisk/api/v2.py +++ b/lawrisk/api/v2.py @@ -6,7 +6,7 @@ import time from io import BytesIO from flask import Blueprint, jsonify, request, send_file from concurrent.futures import ThreadPoolExecutor -from typing import Any, Dict, Optional +from typing import Any, Dict, Iterable, Optional from lawrisk.api.auth import login_required, get_current_user, ensure_admin_access from lawrisk.services.lawrisk_v2_service import search_v2, list_regions, suggest_related_questions @@ -235,6 +235,18 @@ def super_admin_page(): return send_file(html_path, mimetype='text/html') +@v2_bp.route('/admin/v2-debug', methods=['GET']) +def super_admin_v2_debug_page(): + """Serve the V2 debugging console for super administrators.""" + _, error = _admin_guard(roles=("admin",)) + if error: + return error + html_path = os.path.join(_project_root(), 'static', 'v2_admin_debug.html') + if not os.path.exists(html_path): + return jsonify({"success": False, "message": "调试页面不存在"}), 404 + return send_file(html_path, mimetype='text/html') + + @v2_bp.route('/admin/users', methods=['GET']) def admin_list_users(): """List users for the super admin console.""" @@ -1479,4 +1491,3 @@ def admin_permits_filter_options(): except Exception as exc: print(f"admin_permits_filter_options error: {exc}") return jsonify({"success": False, "message": str(exc)}), 500 - diff --git a/static/v2_admin_debug.html b/static/v2_admin_debug.html new file mode 100644 index 0000000..aa2ee8e --- /dev/null +++ b/static/v2_admin_debug.html @@ -0,0 +1,1014 @@ + + + + + + LawRisk V2 超级管理员调试台 + + + +
+
+
+

LawRisk V2 超级管理员调试台

+
面向 V2 问答与许可筛选的调试工具,需已登录并具备管理员权限。
+
+
+ Super Admin Only + + +
+
+ +
+
+
+

V2 问答接口调试

+
选择地区 + 输入问题,可切换 debug 与 top 参数,右侧可直达许可详情。
+
+
+ +
+
+ +
+
+
+ + +
+
+ + +
+
+
+ + +
+
+ +
+ + debug=1 +
+
+
+
+
+ + +
+
+
+
+ +
+ +
+
+
+

许可筛选与查询

+
多维筛选(地区/主题/部门/关键词),点击行可查看详情。
+
+
+ +
+
+ +
+
+
+ +
+
+
+ +
+
+
+ +
+
+
+ + +
+
+
+ + +
+
+ + +
+
+
+
+ + +
+
+
+
+ +
+
+ +
+ + + + +