From 94e5cd482beb678aaabbdeeb80c2537b2e7c5157 Mon Sep 17 00:00:00 2001 From: "DESKTOP-1JS6RSM\\Admin" Date: Fri, 6 Mar 2026 10:30:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=91=8A=E8=AD=A6=E9=80=BB=E8=BE=91=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E4=BC=98=E5=85=88=E7=BA=A7=E8=A6=86=E7=9B=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- iti/applications/service/iot/alert.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/iti/applications/service/iot/alert.py b/iti/applications/service/iot/alert.py index ee94132..89099f8 100644 --- a/iti/applications/service/iot/alert.py +++ b/iti/applications/service/iot/alert.py @@ -64,7 +64,7 @@ def add_node_alert_log(node_id: int, alert_value: str): if not node: return "节点不存在" - alert_rule_list = db.session.scalars(select(IotAlertRule).filter_by(node_id=node_id)).all() + alert_rule_list = db.session.scalars(select(IotAlertRule).filter_by(node_id=node_id).order_by(desc(IotAlertRule.alert_level))).all() if len(alert_rule_list) > 0: for alert_rule in alert_rule_list: if alert_rule.status == 1: @@ -92,8 +92,7 @@ def add_node_alert_log(node_id: int, alert_value: str): alert_log = IotAlertLog(**dict_data) db.session.add(alert_log) db.session.commit() - else: - current_app.logger.info(f"节点{node.node_number}值{alert_value}未触发告警规则{alert_rule.alert_rule}") + break return ""