This commit is contained in:
xyj 2024-01-26 17:43:13 +08:00
parent b0fc098b62
commit 5ba48622d6
1 changed files with 11 additions and 11 deletions

22
xumu.py
View File

@ -152,20 +152,20 @@ async def register(request: Request):
if len(v) != 0:
return BaseResponse(code=302, msg="该设备已经注册过了")
# 创建该设备
send_json = {
"devices": ["root.device"],
"timestamps": [int(time.time() * 1000)],
"measurements_list": [["iccid", "deviceId", "type"]],
"data_types_list": [["TEXT", "TEXT", "INT32"]],
"values_list": [[iccid, deviceId, type]],
"is_aligned": False
}
# TODO 测试
# send_json = {
# "sql": f"insert into root.device(iccid, deviceId, type) values('{iccid}', '{deviceId}', {type})"
# "devices": ["root.device"],
# "timestamps": [int(time.time() * 1000)],
# "measurements_list": [["iccid", "deviceId", "type"]],
# "data_types_list": [["TEXT", "TEXT", "INT32"]],
# "values_list": [[iccid, deviceId, type]],
# "is_aligned": False
# }
# TODO 测试
send_json = {
"sql": f"insert into root.device(iccid, deviceId, type) values('{iccid}', '{deviceId}', {type})"
}
res = []
r = requests.post(baseHost + insertUri, headers=headers, json=send_json)
r = requests.post(baseHost + nonQueryUri, headers=headers, json=send_json)
res.append(r.json())
# 插入设备状态表
send_json = {