移除响应指令管理规则测试功能及接口
1. 删除页面中的规则测试区域,简化管理端交互。 2. 删除前端关联状态与方法,避免无用请求与冗余代码。 3. 删除后端/api/test_match接口,保持蓝图能力与页面一致。
This commit is contained in:
@@ -235,31 +235,3 @@ def api_toggle_rule(rule_id: int):
|
||||
return jsonify({"success": False, "message": "切换失败"}), 500
|
||||
|
||||
return jsonify({"success": True, "message": "状态已更新"})
|
||||
|
||||
|
||||
@fun_command_rules_bp.route("/api/test_match", methods=["POST"])
|
||||
@login_required
|
||||
def api_test_match():
|
||||
"""提供后台测试入口,便于快速验证规则命中结果。"""
|
||||
server = current_app.dashboard_server
|
||||
service = server.fun_command_rule_service
|
||||
|
||||
raw = request.get_json(silent=True) or {}
|
||||
scope_type = str(raw.get("scope_type", "group") or "group").strip().lower()
|
||||
scope_id = str(raw.get("scope_id", "") or "").strip()
|
||||
content = str(raw.get("content", "") or "").strip()
|
||||
event_key = str(raw.get("event_key", "") or "").strip().upper()
|
||||
|
||||
session_key = scope_id or "test-session"
|
||||
matched = service.match_rule(
|
||||
scope_type=scope_type,
|
||||
scope_id=scope_id,
|
||||
content=content,
|
||||
event_key=event_key,
|
||||
session_key=session_key,
|
||||
)
|
||||
|
||||
if not matched:
|
||||
return jsonify({"success": True, "matched": False, "data": None})
|
||||
|
||||
return jsonify({"success": True, "matched": True, "data": matched})
|
||||
|
||||
Reference in New Issue
Block a user