Browse Source

记录视频播放时长接口解密uid,do_attach_uid和create_keys_and_certificate函数国外正式配置使用固定值的ip

locky 3 years ago
parent
commit
b2dd32cdbc

+ 6 - 0
Controller/CloudStorage.py

@@ -11,6 +11,7 @@
 @file: cloudstorage.py
 @file: cloudstorage.py
 @Contact: chanjunkai@163.com
 @Contact: chanjunkai@163.com
 """
 """
+import base64
 import json
 import json
 import os
 import os
 import time
 import time
@@ -1590,6 +1591,11 @@ class CloudStorageView(View):
             parms = eval(parms)
             parms = eval(parms)
             for parm in parms:
             for parm in parms:
                 parm['userID'] = userID
                 parm['userID'] = userID
+                # 解密uid
+                for i in range(1, 4):
+                    parm['uid'] = base64.b64decode(parm['uid'])
+                    parm['uid'] = parm['uid'].decode('utf-8')
+                    parm['uid'] = parm['uid'][i:-i]
                 VideoPlaybackTimeModel.objects.create(**parm)
                 VideoPlaybackTimeModel.objects.create(**parm)
             return response.json(0)
             return response.json(0)
         except Exception as e:
         except Exception as e:

+ 5 - 2
Controller/IotCoreController.py

@@ -12,7 +12,7 @@ from django.views import View
 from Ansjer.config import BASE_DIR, AWS_IOT_GETS3_PULL_CHINA_ID, AWS_IOT_GETS3_PULL_CHINA_SECRET, \
 from Ansjer.config import BASE_DIR, AWS_IOT_GETS3_PULL_CHINA_ID, AWS_IOT_GETS3_PULL_CHINA_SECRET, \
     AWS_IOT_GETS3_PULL_FOREIGN_ID, AWS_IOT_GETS3_PULL_FOREIGN_SECRET, AWS_ARN, AWS_IOT_SES_ACCESS_CHINA_REGION, \
     AWS_IOT_GETS3_PULL_FOREIGN_ID, AWS_IOT_GETS3_PULL_FOREIGN_SECRET, AWS_ARN, AWS_IOT_SES_ACCESS_CHINA_REGION, \
     AWS_IOT_SES_ACCESS_FOREIGN_REGION_ASIA, AWS_IOT_SES_ACCESS_FOREIGN_REGION_EUROPE, \
     AWS_IOT_SES_ACCESS_FOREIGN_REGION_ASIA, AWS_IOT_SES_ACCESS_FOREIGN_REGION_EUROPE, \
-    AWS_IOT_SES_ACCESS_FOREIGN_REGION_AMERICA
+    AWS_IOT_SES_ACCESS_FOREIGN_REGION_AMERICA, SERVER_TYPE
 from base64 import b64encode, encodebytes
 from base64 import b64encode, encodebytes
 from Controller.DeviceConfirmRegion import Device_Region
 from Controller.DeviceConfirmRegion import Device_Region
 from Model.models import Device_User, Device_Info, iotdeviceInfoModel, UIDCompanySerialModel, \
 from Model.models import Device_User, Device_Info, iotdeviceInfoModel, UIDCompanySerialModel, \
@@ -113,7 +113,10 @@ class IotCoreView(View):
         # 判断设备是否已注册证书
         # 判断设备是否已注册证书
         if not iotdeviceInfo_qs.exists():
         if not iotdeviceInfo_qs.exists():
             thingGroup = device_version + '_' + language
             thingGroup = device_version + '_' + language
-            ip = CommonService.get_ip_address(request)
+            if SERVER_TYPE == 'Ansjer.us_config.formal_settings':  # 国外正式配置使用固定ip进行测试
+                ip = '67.220.90.13'
+            else:
+                ip = CommonService.get_ip_address(request)
             region_id = Device_Region().get_device_region(ip)
             region_id = Device_Region().get_device_region(ip)
 
 
             iotClient = IOTClient(region_id)
             iotClient = IOTClient(region_id)

+ 5 - 3
Controller/SerialNumberController.py

@@ -17,7 +17,7 @@ from Object.uidManageResponseObject import uidManageResponseObject
 from Object.TokenObject import TokenObject
 from Object.TokenObject import TokenObject
 from Service.AlgorithmService import AlgorithmBaseOn35
 from Service.AlgorithmService import AlgorithmBaseOn35
 from Service.CommonService import CommonService
 from Service.CommonService import CommonService
-from Ansjer.config import CRCKey
+from Ansjer.config import CRCKey, SERVER_TYPE
 from Service.ModelService import ModelService
 from Service.ModelService import ModelService
 from Object.AWS.S3Email import S3Email
 from Object.AWS.S3Email import S3Email
 
 
@@ -149,8 +149,10 @@ class SerialNumberView(View):
             p2p_type = serial_number[9:10]
             p2p_type = serial_number[9:10]
         try:
         try:
             if not country_id:
             if not country_id:
-                ip = CommonService.get_ip_address(request)
-                ip = '67.220.90.13'     # 仅用于模拟国外环境测试
+                if SERVER_TYPE == 'Ansjer.us_config.formal_settings':   # 国外正式配置使用固定ip进行测试
+                    ip = '67.220.90.13'
+                else:
+                    ip = CommonService.get_ip_address(request)
                 country_id = Device_Region().get_device_region(ip)
                 country_id = Device_Region().get_device_region(ip)
 
 
             # 判断序列号是否已和企业关联
             # 判断序列号是否已和企业关联