chenjunkai 5 years ago
parent
commit
bdcaa716c6
2 changed files with 10 additions and 3 deletions
  1. 9 2
      Controller/DetectController.py
  2. 1 1
      Object/ETkObject.py

+ 9 - 2
Controller/DetectController.py

@@ -50,6 +50,7 @@ class NotificationView(View):
     def validation(self, request_dict):
         response = ResponseObject()
         uidToken = request_dict.get('uidToken', None)
+        etk = request_dict.get('etk', None)
         channel = request_dict.get('channel', '1')
         n_time = request_dict.get('n_time', None)
         event_type = request_dict.get('event_type', None)
@@ -59,8 +60,14 @@ class NotificationView(View):
                 'code': 444,
                 'msg': 'param is wrong'})
             # return response.json(444)
-        utko = UidTokenObject(uidToken)
-        uid = utko.UID
+        if etk:
+            eto = ETkObject(etk)
+            uid = eto.uid
+            if len(uid) != 20:
+                return JsonResponse(status=200, data={'code': 404, 'msg': 'data is not exist'})
+        else:
+            utko = UidTokenObject(uidToken)
+            uid = utko.UID
         redisObj = RedisObject(db=6)
         # pkey = '{uid}_{channel}_ptl'.format(uid=uid, channel=channel)
         pkey = '{uid}_ptl'.format(uid=uid)

+ 1 - 1
Object/ETkObject.py

@@ -62,7 +62,7 @@ class ETkObject(object):
 # print('encode_data:')
 # print(PP)
 # print('decode_data:')
-# eobj = ETkObject(etk=PP)
+# eobj = ETkObject(etk='T1dha3hDUkZOVk9UVTBOMDVVVWxOTlJqRXhNVUU9U2w=')
 # uid = eobj.uid
 # print(uid)