Explorar o código

设备获取证书 返回重复值

chenshibin %!s(int64=4) %!d(string=hai) anos
pai
achega
f683d9ba48
Modificáronse 1 ficheiros con 10 adicións e 1 borrados
  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)