Bläddra i källkod

音视频通话

peng 2 år sedan
förälder
incheckning
6117966a5a
3 ändrade filer med 10 tillägg och 10 borttagningar
  1. 2 2
      Controller/DetectControllerV2.py
  2. 6 6
      Service/DevicePushService.py
  3. 2 2
      Service/PushService.py

+ 2 - 2
Controller/DetectControllerV2.py

@@ -76,7 +76,7 @@ class NotificationV2View(View):
             req_limiting = '{uid}_{channel}_{event_type}_ptl'.format(uid=uid, channel=channel, event_type=event_type)
             cache_req_limiting = redis_obj.get_data(key=req_limiting)  # 获取请求限流缓存数据
             cache_app_push = redis_obj.get_data(key=push_interval)  # 获取APP推送消息时间间隔缓存数据
-            if event_type != 606:
+            if event_type not in [606, 607]:
                 if cache_req_limiting:  # 限流存在则直接返回
                     return JsonResponse(status=200, data={'code': 0, 'msg': 'Push again in one minute'})
             redis_obj.set_data(key=req_limiting, val=1, expire=60)  # 当缓存不存在限流数据 重新设置一分钟请求一次
@@ -97,7 +97,7 @@ class NotificationV2View(View):
 
             # APP消息提醒推送间隔
             detect_interval = uid_set_push_list[0]['uid_set__detect_interval']
-            if event_type != 606:
+            if event_type not in [606, 607]:
                 if not cache_app_push:
                     # 缓存APP提醒推送间隔 默认1分钟提醒一次
                     DevicePushService.cache_push_detect_interval(redis_obj, push_interval, detect_interval,

+ 6 - 6
Service/DevicePushService.py

@@ -94,7 +94,7 @@ class DevicePushService:
         @param event_type: 事件类型
         @return: uid_push_qs
         """
-        if event_type != 606:
+        if event_type not in [606, 607]:
             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',
@@ -155,7 +155,7 @@ class DevicePushService:
         # 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'] == 606 else \
+            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'])
             for up in uid_set_push_list:
                 appBundleId = up['appBundleId']
@@ -176,7 +176,7 @@ class DevicePushService:
                 kwag_args['token_val'] = token_val
                 kwag_args['msg_title'] = msg_title
                 kwag_args['msg_text'] = msg_text
-                if params['event_type'] == 606 and up['push_type'] in [5, 6]:
+                if params['event_type'] in [606, 607] and up['push_type'] in [5, 6]:
                     kwag_args['jg_token_val'] = up['jg_token_val']
                 else:
                     if 'jg_token_val' in kwag_args:
@@ -455,7 +455,7 @@ class DevicePushService:
                 msg_type = '摄像头休眠'
             elif event_type == 703:
                 msg_type = '摄像头唤醒'
-            elif event_type == 606:
+            elif event_type in [606, 607]:
                 msg_type = '有人呼叫,请点击查看'
             elif ai_type > 0 and event_list:
                 msg_type = ''.join([DevicePushService.get_event_type_text(lang, item, dealings_type)
@@ -498,7 +498,7 @@ class DevicePushService:
                 msg_type = 'Camera sleep'
             elif event_type == 703:
                 msg_type = 'Camera wake'
-            elif event_type == 606:
+            elif event_type in [606, 607]:
                 msg_type = 'Someone is calling, please click to view'
             elif ai_type > 0 and event_list:
                 msg_type = ''.join([DevicePushService.get_event_type_text(lang, item, dealings_type)
@@ -604,7 +604,7 @@ class DevicePushService:
         response = requests.post(push_url, data=push_data, headers=headers)
         if response.status_code == 200:
             LOGGING.info("oppo推送返回值:{},uid:{},time:{},event:{}".format(response.json(), uid, now_time, event_type))
-            if event_type == 606 or event_type == '606':
+            if event_type in [606, 607]:
                 PushObject.jpush_transparent_transmission(msg_title, msg_text, appBundleId, jg_token_val, extra_data)
             return response.json()
 

+ 2 - 2
Service/PushService.py

@@ -330,7 +330,7 @@ class PushObject:
                 .message_dict()
             rec = sender_send.send(message)
             logger.info('vivo推送结果:{}, 设备uid:{}'.format(rec, uid))
-            if rec['result'] == 0 and (event_type == 606 or event_type == '606'):
+            if rec['result'] == 0 and event_type in [606, 607]:
                 PushObject.jpush_transparent_transmission(msg_title, msg_text, app_bundle_id, jg_token_val, push_data)
             return rec
         except Exception as e:
@@ -405,7 +405,7 @@ class PushObject:
 
             response = requests.post(push_url, data=push_data, headers=headers)
             logger.info("oppo推送返回值:{}".format(response.json()))
-            if response.status_code == 200 and (event_type == 606 or event_type == '606'):
+            if response.status_code == 200 and event_type in [606, 607]:
                 PushObject.jpush_transparent_transmission(msg_title, msg_text, app_bundle_id, jg_token_val, extra_data)
         except Exception as e:
             return repr(e)