Browse Source

设备获取证书 返回重复值

chenshibin 4 years ago
parent
commit
f683d9ba48
1 changed files with 10 additions and 1 deletions
  1. 10 1
      Controller/IotCoreController.py

+ 10 - 1
Controller/IotCoreController.py

@@ -134,7 +134,16 @@ class IotCoreView(View):
                                                       Thingname=res[1]['ThingName'])
                     return response.json(0, {'res': res})
             else:
+                dev_qs = Device_Info.objects.filter(UID=uid)
+                iot = iotdeviceInfoModel.objects.get(UID=uid)
+                res = {
+                    'certificateId': iot.certificateId,
+                    'certificatePem': iot.certificatePem,
+                    'publicKey': iot.publicKey,
+                    'privateKey': iot.privateKey,
+                    'endpoint': dev_qs[0]['endpoint']
+                }
                 # print('此设备已注册证书')
-                return response.json(10042)
+                return response.json(0, {'res': res})
         else:
             return response.json(444)