ソースを参照

一键通话不开推送开关也能推送

peng 2 年 前
コミット
7890d3ac03

+ 4 - 1
Controller/DetectController.py

@@ -70,16 +70,19 @@ class NotificationView(View):
             detect_med_type = 0  # 0推送旧机制 1存库不推送,2推送存库
             # 暂时注销
             if event_type != 606:
+                detect_status = 1
                 if have_pkey:
                     res_data = {'code': 0, 'msg': 'Push it once a minute'}
                     return JsonResponse(status=200, data=res_data)
+            else:
+                detect_status = 0
 
             # 数据库读取数据
             if have_ykey:
                 uid_push_list = eval(redisObj.get_data(key=ykey))
             else:
                 # 从数据库查询出来
-                uid_push_qs = DevicePushService.query_uid_push(uid)
+                uid_push_qs = DevicePushService.query_uid_push(uid, detect_status)
                 if not uid_push_qs.exists():
                     logger.info('消息推送-uid_push 数据不存在')
                     return JsonResponse(status=200, data={'code': 176, 'msg': 'no uid_push data'})

+ 4 - 1
Controller/DetectControllerV2.py

@@ -88,10 +88,13 @@ class NotificationV2View(View):
             logger.info('消息推送- 限流key: {}, 推送间隔key: {}'.
                         format(cache_req_limiting, cache_app_push))
             if event_type != 606:
+                detect_status = 1
                 if cache_req_limiting:  # 限流存在则直接返回
                     return JsonResponse(status=200, data={'code': 0, 'msg': 'Push again in one minute'})
+            else:
+                detect_status = 0
             redisObj.set_data(key=req_limiting, val=1, expire=60)  # 当缓存不存在限流数据 重新设置一分钟请求一次
-            uid_push_qs = DevicePushService.query_uid_push(uid)  # 查询uid_set与push数据列表
+            uid_push_qs = DevicePushService.query_uid_push(uid, detect_status)  # 查询uid_set与push数据列表
             if not uid_push_qs.exists():
                 logger.info('消息推送-uid_push 数据不存在')
                 return JsonResponse(status=200, data={'code': 176, 'msg': 'no uid_push data'})

+ 2 - 2
Service/DevicePushService.py

@@ -51,11 +51,11 @@ class DevicePushService:
         return uid
 
     @classmethod
-    def query_uid_push(cls, uid):
+    def query_uid_push(cls, uid, detect_status):
         """
         查询uid_set与push数据列表
         """
-        uid_push_qs = UidPushModel.objects.filter(uid_set__uid=uid, uid_set__detect_status=1). \
+        uid_push_qs = UidPushModel.objects.filter(uid_set__uid=uid, uid_set__detect_status=detect_status). \
             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__new_detect_interval')