update
This commit is contained in:
parent
6ae16e0e66
commit
d6b91ef776
16
xumu.py
16
xumu.py
|
@ -168,30 +168,28 @@ async def process_data(request: Request):
|
|||
send_len = payload["l"]
|
||||
if receive_len != send_len:
|
||||
print("校验错误,收到的消息长度:", receive_len)
|
||||
return BaseResponse(code=301, msg="data valid error")
|
||||
return BaseResponse(code=301, msg=f"data valid error,receive_len:{receive_len}")
|
||||
m = payload["m"]
|
||||
v = payload["v"]
|
||||
t = payload["t"]
|
||||
deviceId = v[0]
|
||||
m.append("t")
|
||||
v.append(t)
|
||||
res = []
|
||||
# 判断t是否为0,0 则代表是RFID设备,需要做一个映射
|
||||
# 判断t是否为0,0则代表是RFID设备,需要做一个映射
|
||||
if t == 0:
|
||||
rfid = v[1]
|
||||
deviceId = v[0]
|
||||
sql_list = rfid_deviceId(rfid, deviceId)
|
||||
sql = sql_list[0]
|
||||
send_json = {
|
||||
"sql": sql
|
||||
}
|
||||
r = requests.post(baseHost + nonQueryUri, headers=headers, json=send_json)
|
||||
if r.status_code != 200:
|
||||
return BaseResponse(code=r.status_code, msg=r.json())
|
||||
if r.status_code == 200:
|
||||
r = r.json()
|
||||
if r["code"] != 200:
|
||||
return BaseResponse(code=500, msg=r)
|
||||
return BaseResponse(code=500, msg="RFID创建映射失败", data=r)
|
||||
res.append(r)
|
||||
deviceId = v[0]
|
||||
m.append("t")
|
||||
v.append(t)
|
||||
send_json = {
|
||||
"devices": ["root.farm." + deviceId],
|
||||
"timestamps": [int(time.time() * 1000)],
|
||||
|
|
Loading…
Reference in New Issue