소스 검색

设备获取证书 返回重复值

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'])
                     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)