diff --git a/admin/dashboard/blueprints/fun_command_rules.py b/admin/dashboard/blueprints/fun_command_rules.py index 5170884..081f3bb 100644 --- a/admin/dashboard/blueprints/fun_command_rules.py +++ b/admin/dashboard/blueprints/fun_command_rules.py @@ -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}) diff --git a/admin/dashboard/templates/fun_command_rules.html b/admin/dashboard/templates/fun_command_rules.html index ae72521..9c1a0ef 100644 --- a/admin/dashboard/templates/fun_command_rules.html +++ b/admin/dashboard/templates/fun_command_rules.html @@ -80,39 +80,6 @@ - -
规则测试
- - - - - - - - - - - - - - - - - - - - - 测试命中 - - - - -
- @@ -288,13 +255,6 @@ new Vue({ dialogVisible: false, editing: false, editingRuleId: 0, - testResult: null, - tester: { - scope_type: 'group', - scope_id: '', - event_key: '', - content: '' - }, form: { rule_name: '', scope_type: 'global', @@ -613,22 +573,6 @@ new Vue({ this.$message.error(msg) } row.enabled = !enabled - }, - async testMatch() { - try { - const resp = await axios.post('/fun_command_rules/api/test_match', this.tester) - if (resp.data && resp.data.success) { - this.testResult = { - matched: !!resp.data.matched, - data: resp.data.data || null - } - return - } - this.$message.error((resp.data && resp.data.message) || '测试失败') - } catch (error) { - const msg = (error.response && error.response.data && error.response.data.message) || '测试失败' - this.$message.error(msg) - } } } })