فهرست منبع

优化数据空判断

zhangdongming 10 ماه پیش
والد
کامیت
c0f874dd01
1فایلهای تغییر یافته به همراه2 افزوده شده و 1 حذف شده
  1. 2 1
      Controller/DetectControllerV2.py

+ 2 - 1
Controller/DetectControllerV2.py

@@ -115,7 +115,8 @@ class DetectControllerViewV2(View):
             target_key = f'channel{channel}'
             # 初始化存在标志
             channel_found = False
-            new_data = {target_key: list(map(int, event_types.split(',')))}
+            # 使用 map() 和条件表达式
+            new_data = {target_key: list(map(int, event_types.split(','))) if event_types else []}
             # 检查 msg_notify 是否存在且包含 'nvr'
             if msg_notify and 'nvr' in msg_notify: