This commit is contained in:
xyj 2024-01-25 09:47:30 +08:00
parent 823fbfa21b
commit f9af3434db
1 changed files with 3 additions and 0 deletions

View File

@ -89,6 +89,7 @@ async def register(request: Request):
payload = json.loads(payload) payload = json.loads(payload)
send_len = payload["l"] send_len = payload["l"]
if receive_len != send_len: if receive_len != send_len:
print(receive_len)
return BaseResponse(code=301, msg=f"data valid error, receive_len:{receive_len}") return BaseResponse(code=301, msg=f"data valid error, receive_len:{receive_len}")
deviceId = payload["d"] deviceId = payload["d"]
iccid = payload["cid"] iccid = payload["cid"]
@ -96,6 +97,7 @@ async def register(request: Request):
# 该设备是否已经创建 # 该设备是否已经创建
device = Device(iccid=iccid, deviceId=deviceId, type=type) device = Device(iccid=iccid, deviceId=deviceId, type=type)
a_device = await get_device(device) a_device = await get_device(device)
print(a_device)
if a_device.code == 200: if a_device.code == 200:
v = a_device.data["values"] v = a_device.data["values"]
if len(v) != 0: if len(v) != 0:
@ -120,6 +122,7 @@ async def register(request: Request):
} }
r = requests.post(baseHost + nonQueryUri, headers=headers, json=send_json) r = requests.post(baseHost + nonQueryUri, headers=headers, json=send_json)
res.append(r.json()) res.append(r.json())
print(res)
return BaseResponse(data=res) return BaseResponse(data=res)
except Exception as e: except Exception as e:
return BaseResponse(code=500, msg=str(e)) return BaseResponse(code=500, msg=str(e))