Pārlūkot izejas kodu

添加时间戳加密,find_device_serial函数

yeweidong 2 gadi atpakaļ
vecāks
revīzija
eaeba3aaf6
1 mainītis faili ar 4 papildinājumiem un 3 dzēšanām
  1. 4 3
      Controller/TestApi.py

+ 4 - 3
Controller/TestApi.py

@@ -1033,7 +1033,10 @@ class testView(View):
             firmware_time_code_no = request_dict.get('firmwareTimeCode', None)
             function_type_str = request_dict.get('functionType', None)
             serial_no = request_dict.get('serialNo', None)
-            print('00000')
+            time_stamp = request_dict.get('timeStamp', None)
+            sign = request_dict.get('sign', None)
+            if not CommonService.check_time_stamp_token(sign, time_stamp):
+                return response.json(13)
             if not function_type_str:
                 return response.json(444)
             with transaction.atomic():
@@ -1048,10 +1051,8 @@ class testView(View):
                               'serial_number': serial_no,
                               'created_time': nowtime}
                     TestDeviceFindSerial.objects.create(**params)
-                    print('111111')
                     return response.json(0)
                 elif function_type_str == 'get_device-serial':  # 根据固件码获取序列号
-                    print('222222')
                     if not firmware_time_code_no:
                         return response.json(444)
                     if first_firmwares_qs.exists():