Kaynağa Gözat

修复人形报警侦测问题

locky 3 yıl önce
ebeveyn
işleme
32e406c5b4
1 değiştirilmiş dosya ile 10 ekleme ve 8 silme
  1. 10 8
      Controller/DetectControllerV2.py

+ 10 - 8
Controller/DetectControllerV2.py

@@ -77,22 +77,24 @@ class NotificationView(View):
             is_st = int(is_st)
             region = int(region)
 
-            # 调试
+            # 解密获取uid
             if etk:
                 eto = ETkObject(etk)
                 uid = eto.uid
-                if len(uid) != 20 and len(uid) != 14:
-                    return JsonResponse(status=200, data={'code': 404, 'msg': 'wrong uid'})
             else:
-                utko = UidTokenObject(uidToken)
-                uid = utko.UID
+                uto = UidTokenObject(uidToken)
+                uid = uto.UID
+            # uid = request_dict.get('uid', None)     # 调试
+            # 判断uid长度
+            if len(uid) != 20 and len(uid) != 14:
+                return JsonResponse(status=200, data={'code': 404, 'msg': 'wrong uid'})
             logger.info('调用推送接口的uid:{}'.format(uid))
 
-            pkey = '{uid}_{channel}_{event_type}_ptl'.format(uid=uid, event_type=event_type, channel=channel)
+            pkey = '{uid}_{channel}_{event_type}_ptl'.format(uid=uid, channel=channel, event_type=event_type)
             ykey = '{uid}_redis_qs'.format(uid=uid)
             is_sys_msg = self.is_sys_msg(int(event_type))
             if is_sys_msg:
-                dkey = '{uid}_{channel}_{event_type}_flag'.format(uid=uid, event_type=event_type, channel=channel)
+                dkey = '{uid}_{channel}_{event_type}_flag'.format(uid=uid, channel=channel, event_type=event_type)
             else:
                 dkey = '{uid}_{channel}_flag'.format(uid=uid, channel=channel)
 
@@ -267,7 +269,7 @@ class NotificationView(View):
                 for i in range(is_st):
                     thumbspng = '{uid}/{channel}/{filename}_{st}.jpeg'. \
                         format(uid=uid, channel=channel, filename=n_time, st=i)
-                    Params['key'] = thumbspng
+                    Params['Key'] = thumbspng
                     response_url = generate_s3_url(aws_s3_client, Params)
                     img_url_list.append(response_url)