Browse Source

推送数据alarm为空时返回指定格式

locky 4 months ago
parent
commit
d0b6607cbe
2 changed files with 2 additions and 1 deletions
  1. 0 1
      Controller/DetectControllerV2.py
  2. 2 0
      Service/EquipmentInfoService.py

+ 0 - 1
Controller/DetectControllerV2.py

@@ -563,7 +563,6 @@ class DetectControllerViewV2(View):
                     equipment_info['ai_event_type_list'] = list(map(int, str(event_type)))
                 if EquipmentInfoService.is_combo_tag(event_type, event_tag):
                     equipment_info['ai_event_type_list'] += EquipmentInfoService.get_combo_types(event_type, event_tag)
-                equipment_info['alarm'] = 'Motion \tChannel:{channel}'.format(channel=channel)
                 res.append(equipment_info)
             return response.json(0, {'datas': res, 'count': count})
         except Exception as e:

+ 2 - 0
Service/EquipmentInfoService.py

@@ -500,6 +500,8 @@ class EquipmentInfoService:
             equipment_info['addTime'] = equipment_info['add_time']
             equipment_info['borderCoords'] = equipment_info['border_coords']
             equipment_info['eventTag'] = equipment_info['event_tag']
+            if equipment_info['alarm'] == '':
+                equipment_info['alarm'] = 'Motion \tChannel:{}'.format(equipment_info['channel'])
             equipment_info.pop('device_uid')
             equipment_info.pop('device_nick_name')
             equipment_info.pop('channel')