Selaa lähdekoodia

注释限制消息类型提醒逻辑

zhangdongming 1 vuosi sitten
vanhempi
commit
67629ad8a0
2 muutettua tiedostoa jossa 8 lisäystä ja 6 poistoa
  1. 1 0
      Controller/DetectControllerV2.py
  2. 7 6
      Service/DevicePushService.py

+ 1 - 0
Controller/DetectControllerV2.py

@@ -164,6 +164,7 @@ def push_and_save_data(**params):
     TIME_LOGGER.info('{}开始异步推送'.format(params['uid']))
     # 推送消息,生成推送数据列表
     result = DevicePushService.save_msg_push(**params)
+    TIME_LOGGER.info('{}APP消息推送result:{}'.format(params['uid'], result))
     # 保存推送数据
     TIME_LOGGER.info('{}开始异步存表'.format(params['uid']))
     save_success = DevicePushService.save_sys_msg(

+ 7 - 6
Service/DevicePushService.py

@@ -155,7 +155,7 @@ class DevicePushService:
             params['event_tag'] = cls.get_event_tag(params['ai_type'], params['event_type'], params['detection'])
             is_app_push = True if params['event_type'] in [606, 607] else \
                 cls.is_send_app_push(params['event_type'], params['event_tag'], params['app_push_config'],
-                                     params['app_push'])
+                                     params['app_push'], params['uid'])
             for up in params['uid_set_push_list']:
                 appBundleId = up['appBundleId']
                 token_val = up['token_val']
@@ -737,7 +737,7 @@ class DevicePushService:
         return True if c else False
 
     @staticmethod
-    def is_send_app_push(event_type, event_tag, app_push_config, msg_interval=None):
+    def is_send_app_push(event_type, event_tag, app_push_config, msg_interval=None, uid=None):
         """
         是否进行APP消息提醒
         @return: True|False
@@ -759,14 +759,14 @@ class DevicePushService:
                 push_time_config = app_push_config['pushTime']
                 # 计算当前时间是否在自定义消息提醒范围内
                 if not DevicePushService.is_push_notify_allowed_now(push_time_config):
-                    LOGGING.info('APP推送提醒不在自定义时间内:{}'.format(push_time_config))
+                    LOGGING.info('{}APP推送提醒不在自定义时间内:{}'.format(uid, push_time_config))
                     return False
             # APP接收提醒,判断识别类型是否勾选提醒
             push_result = DevicePushService.is_type_push(event_type, event_tag, app_event_types)
-            LOGGING.info('APP推送提醒是否执行:{}'.format(push_result))
+            LOGGING.info('{}APP推送消息类型提醒是否执行:{}'.format(uid, push_result))
             return push_result
         except Exception as e:
-            LOGGING.info('判断是否执行APP推送异常,errLine:{}, errMsg:{}'.format(e.__traceback__.tb_lineno, repr(e)))
+            LOGGING.info('{}判断是否执行APP推送异常,errLine:{}, errMsg:{}'.format(uid, e.__traceback__.tb_lineno, repr(e)))
             return True
 
     @staticmethod
@@ -779,7 +779,8 @@ class DevicePushService:
             return any(item in app_event_types for item in tag_list)
 
         # 检查事件类型和用户所选事件类型是否都存在,并判断事件类型在用户所选事件类型列表中
-        return event_type and app_event_types and event_type in app_event_types
+        # return event_type and app_event_types and event_type in app_event_types
+        return True
 
     @staticmethod
     def is_push_notify_allowed_now(push_time_config):