Kaynağa Gözat

APP消息提醒增加时间间隔判断

zhangdongming 1 yıl önce
ebeveyn
işleme
25ab78c988

+ 1 - 1
Controller/DetectController.py

@@ -121,7 +121,7 @@ class NotificationView(View):
             }
             params = {'nickname': nickname, 'uid': uid, 'kwag_args': kwag_args, 'is_st': is_st,
                       'is_sys_msg': is_sys_msg, 'channel': channel, 'event_type': event_type, 'n_time': n_time,
-                      'electricity': '', 'bucket': bucket, 'app_push': '', 'storage_location': 1, 'ai_type': 0,
+                      'electricity': '', 'bucket': bucket, 'app_push': have_dkey, 'storage_location': 1, 'ai_type': 0,
                       'dealings_type': 0, 'detection': 0, 'device_type': 1, 'app_push_config': '',
                       'uid_set_push_list': uid_push_list}
             #  推送以及报警消息存库

+ 7 - 6
Service/DevicePushService.py

@@ -141,7 +141,6 @@ class DevicePushService:
     def save_msg_push(cls, **params):
         """
         推送消息,返回推送数据列表
-        @param uid_set_push_list: redis对象
         @param params: 推送参数
         @return: dict
         """
@@ -151,11 +150,12 @@ class DevicePushService:
         kwag_args = params['kwag_args']
         code_data = {'do_apns_code': '', 'do_fcm_code': '', 'do_jpush_code': ''}
         local_date_time = ''
-        # push_permission = True
+        # push_permission = True 多通道权限限制接收
         try:
             params['event_tag'] = cls.get_event_tag(params['ai_type'], params['event_type'], params['detection'])
-            is_app_push = True if params['event_tag'] in [606, 607] else \
-                cls.is_send_app_push(params['event_type'], params['event_tag'], params['app_push_config'])
+            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'])
             for up in params['uid_set_push_list']:
                 appBundleId = up['appBundleId']
                 token_val = up['token_val']
@@ -727,7 +727,7 @@ class DevicePushService:
         return True if c else False
 
     @staticmethod
-    def is_send_app_push(event_type, event_tag, app_push_config):
+    def is_send_app_push(event_type, event_tag, app_push_config, msg_interval=None):
         """
         是否进行APP消息提醒
         @return: True|False
@@ -739,7 +739,8 @@ class DevicePushService:
             is_push = app_push_config['appPush']
             if is_push != 1:  # 1:进行APP提醒,其它则不执行APP提醒
                 return False
-
+            if msg_interval:  # 存在消息间隔数据缓存 不推送APP消息
+                return False
             all_day = app_push_config['pushTime']['allDay']
             # 允许设备类型APP提醒列表
             app_event_types = app_push_config['eventTypes']['device']