Browse Source

一键通话v1接口不限制推送

peng 2 năm trước cách đây
mục cha
commit
ad59eb6051
1 tập tin đã thay đổi với 9 bổ sung5 xóa
  1. 9 5
      Controller/DetectController.py

+ 9 - 5
Controller/DetectController.py

@@ -43,16 +43,19 @@ class NotificationView(View):
         n_time = request_dict.get('n_time', None)
         event_type = request_dict.get('event_type', None)
         is_st = request_dict.get('is_st', None)
+        uid = request_dict.get('uid', None)
         if not all([channel, n_time]):
             return JsonResponse(status=200, data={'code': 444, 'msg': 'error channel or n_time'})
         try:
-            uid = DevicePushService.decode_uid(etk, uidToken)  # 解密uid
+            if not uid:
+                uid = DevicePushService.decode_uid(etk, uidToken)  # 解密uid
             if len(uid) != 20 and len(uid) != 14:
                 return JsonResponse(status=200, data={'code': 404, 'msg': 'wrong uid'})
             logger.info("旧移动侦测接口的uid:{}".format(uid))
+            event_type = int(event_type)
             pkey = '{uid}_{channel}_{event_type}_ptl'.format(uid=uid, event_type=event_type, channel=channel)
             ykey = '{uid}_redis_qs'.format(uid=uid)
-            is_sys_msg = self.is_sys_msg(int(event_type))
+            is_sys_msg = self.is_sys_msg(event_type)
             if is_sys_msg is True:
                 dkey = '{uid}_{channel}_{event_type}_flag'.format(uid=uid, event_type=event_type, channel=channel)
             else:
@@ -66,9 +69,10 @@ class NotificationView(View):
             # 一分钟外,推送开启状态
             detect_med_type = 0  # 0推送旧机制 1存库不推送,2推送存库
             # 暂时注销
-            if have_pkey:
-                res_data = {'code': 0, 'msg': 'Push it once a minute'}
-                return JsonResponse(status=200, data=res_data)
+            if event_type != 606:
+                if have_pkey:
+                    res_data = {'code': 0, 'msg': 'Push it once a minute'}
+                    return JsonResponse(status=200, data=res_data)
 
             # 数据库读取数据
             if have_ykey: