Browse Source

修改APP消息推送时间间隔问题

zhangdongming 2 years ago
parent
commit
8bda0af4a9
1 changed files with 4 additions and 3 deletions
  1. 4 3
      Controller/DetectControllerV2.py

+ 4 - 3
Controller/DetectControllerV2.py

@@ -95,7 +95,7 @@ class NotificationV2View(View):
             uid_push_qs = UidPushModel.objects.filter(uid_set__uid=uid, uid_set__detect_status=1). \
                 values('token_val', 'app_type', 'appBundleId', 'm_code', 'push_type', 'userID_id', 'userID__NickName',
                        'lang', 'm_code', 'tz', 'uid_set__nickname', 'uid_set__detect_interval', 'uid_set__detect_group',
-                       'uid_set__channel', 'uid_set__ai_type')
+                       'uid_set__channel', 'uid_set__ai_type', 'uid_set__new_detect_interval')
             if not uid_push_qs.exists():
                 logger.info('uid_push 数据不存在')
                 return JsonResponse(status=200, data={'code': 176, 'msg': 'no uid_push data'})
@@ -116,13 +116,14 @@ class NotificationV2View(View):
 
             if not have_dkey:
                 # 设置推送消息的时间间隔
+                new_detect_interval = redis_list[0]['uid_set__new_detect_interval']
+                detect_interval = new_detect_interval if new_detect_interval > 0 else detect_interval
+                detect_interval = 60 if detect_interval < 60 else detect_interval
                 if detect_group == '0' or detect_group == '':
                     redisObj.set_data(key=dkey, val=1, expire=detect_interval)
                 else:
                     detect_group_list = detect_group.split(',')
                     if event_type in detect_group_list:
-                        if detect_interval < 60:
-                            detect_interval = 60
                         redisObj.set_data(key=dkey, val=1, expire=detect_interval)
 
             if is_st == 1 or is_st == 3:  # 使用aws s3