浏览代码

设备获取证书 返回重复值

chenshibin 4 年之前
父节点
当前提交
f683d9ba48
共有 1 个文件被更改,包括 10 次插入1 次删除
  1. 10 1
      Controller/IotCoreController.py

+ 10 - 1
Controller/IotCoreController.py

@@ -134,7 +134,16 @@ class IotCoreView(View):
                                                       Thingname=res[1]['ThingName'])
                                                       Thingname=res[1]['ThingName'])
                     return response.json(0, {'res': res})
                     return response.json(0, {'res': res})
             else:
             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('此设备已注册证书')
                 # print('此设备已注册证书')
-                return response.json(10042)
+                return response.json(0, {'res': res})
         else:
         else:
             return response.json(444)
             return response.json(444)