This commit is contained in:
xyj 2024-01-24 16:27:34 +08:00
parent ed2d3023b8
commit 8e27d64b18
2 changed files with 22 additions and 4 deletions

View File

@ -1,9 +1,9 @@
# 数据库插入类型
import base64
rfid_type = ["TEXT", "TEXT", "FLOAT"]
air_type = ["TEXT", "FLOAT", "FLOAT"]
else_type = ["TEXT", "FLOAT"]
rfid_type = ["TEXT", "TEXT", "FLOAT", "INT32"]
air_type = ["TEXT", "FLOAT", "FLOAT", "INT32"]
else_type = ["TEXT", "FLOAT", "INT32"]
dataTypes = {
0: rfid_type,
1: air_type,
@ -25,3 +25,21 @@ headers = {
'ContentType': 'application/json',
'Authorization': "Basic " + token
}
# RFID
send1 = {
"m": ["cid", "r", "v", "t"],
"v": ["abcd", "rfid", 10.62, 0],
"l": 63
}
# 空气
send2 = {
"m": ["cid", "at", "ah", "t"],
"v": ["test2", 10.62, 50.22, 1],
"l": 65
}
# 普通
send3 = {
"m": ["cid", "v", "t"],
"v": ["test1", 10.62, 2],
"l": 50
}

View File

@ -126,8 +126,8 @@ async def process_data(request: Request):
return 301
m = payload["m"]
v = payload["v"]
t = payload["t"]
cid = v[0]
t = v[-1]
send_json = {
"devices": ["root.farm." + cid],
"timestamps": [int(time.time() * 1000)],