Kaynağa Gözat

优化消息推送事件标签

zhangdongming 2 yıl önce
ebeveyn
işleme
6fd5300d7e

+ 1 - 1
Controller/DetectControllerV2.py

@@ -125,7 +125,7 @@ class NotificationV2View(View):
                       'is_sys_msg': is_sys_msg, 'channel': channel, 'event_type': event_type, 'n_time': n_time,
                       'electricity': electricity, 'bucket': bucket, 'aws_s3_client': aws_s3_client,
                       'app_push': cache_app_push, 'storage_location': 2, 'ai_type': ai_type,
-                      'dealings_type': dealings_type}
+                      'dealings_type': int(dealings_type)}
             logger.info('已创建s3对象,推送数据为:{}'.format(params))
             # APP消息推送与获取报警消息数据列表
             result = DevicePushService.save_msg_push(uid_set_push_list, **params)

+ 8 - 6
Service/DevicePushService.py

@@ -176,11 +176,12 @@ class DevicePushService:
         if ai_type > 0:
             event_res = DEVICE_EVENT_TYPE.get(event_type, 0)
             if event_res > 0:
-                return str(event_res) + ','
+                return ',' + str(event_res) + ','
             event_type = cls.dec_to_bin(event_type)
             types = cls.get_combo_types(event_type)
-            return ','.join(types) + ','
-        return str(event_type) + ','
+            res = ','.join(types) + ','
+            return ',' + res
+        return ',' + str(event_type) + ','
 
     @classmethod
     def get_combo_types(cls, event_type):
@@ -303,7 +304,8 @@ class DevicePushService:
             add_time=int(time.time()),
             storage_location=params['storage_location'],
             border_coords='',
-            event_tag=params['event_tag']
+            event_tag=params['event_tag'],
+            answer_status=True if params['dealings_type'] == 1 else False
         )
 
     @staticmethod
@@ -331,9 +333,9 @@ class DevicePushService:
             elif etype == 606:
                 msg_type = '有人呼叫,请点击查看'
             elif ai_type > 0:
-                if etype == 1024 and int(dealings_type) == 1:
+                if etype == 1024 and dealings_type == 1:
                     msg_type = '有人进入'
-                elif etype == 1024 and int(dealings_type) == 2:
+                elif etype == 1024 and dealings_type == 2:
                     msg_type = '有人离开'
                 elif etype == 512:
                     msg_type = '长时间无人出现'