Browse Source

Merge branch 'dev' of http://192.168.136.99:3000/SERVER/AnsjerServer into dev

lhq 4 years ago
parent
commit
e80171c017
2 changed files with 10 additions and 10 deletions
  1. 9 9
      Controller/EquipmentManagerV3.py
  2. 1 1
      Controller/IotCoreController.py

+ 9 - 9
Controller/EquipmentManagerV3.py

@@ -68,13 +68,16 @@ class EquipmentManagerV3(View):
         encrypt_pass = View_Password
         print("准备解密")
         View_Password = self.decode_pwd(View_Password)
-        Type = int(request_dict.get('Type', None))
-        ChannelIndex = int(request_dict.get('ChannelIndex', None))
+        Type = request_dict.get('Type', None)
+        ChannelIndex = request_dict.get('ChannelIndex', None)
         version = request_dict.get('version', '')
         isCheckMainUser = request_dict.get('isCheckMainUser', None)
         isMainUserExists = False
-        if not all([UID, NickName, View_Account]):  # Type和ChannelIndex可能为0
-            return response.json(444, {'param': 'UID, NickName, View_Account'})
+        if not all([UID, NickName, View_Account, Type, ChannelIndex]):  # Type和ChannelIndex可能为0
+            return response.json(444, {'param': 'UID, NickName, View_Account, Type, ChannelIndex'})
+
+        Type = int(Type)
+        ChannelIndex = int(ChannelIndex)
 
         re_uid = re.compile(r'^[A-Za-z0-9]{14,20}$')
         if not re_uid.match(UID):
@@ -226,13 +229,10 @@ class EquipmentManagerV3(View):
 
             iotqs = iotdeviceInfoModel.objects.filter(serial_number=dvql[0]['serial_number'])
             if iotqs.exists():
-                res['iot'].append(
-                    {
+                res['iot'] = {
                         'endpoint': iotqs[0].endpoint,
                         'token_iot_number': iotqs[0].endpoint
-
-                    }
-                )
+                }
 
             return response.json(0, res)
 

+ 1 - 1
Controller/IotCoreController.py

@@ -41,7 +41,7 @@ class IotCoreView(View):
 
         if operation == 'createKeysAndCertificate':
             return self.create_keys_and_certificate(request_dict, response, request)
-        if operation == 'requestPublishMessage':
+        elif operation == 'requestPublishMessage':
             return self.request_publish_message(request_dict, response, request)
         elif operation == 'thingRegroup':
             return self.thing_regroup(request_dict, response, request)