This commit is contained in:
xyj 2024-01-25 11:59:21 +08:00
parent 3811de2827
commit 3dde96f179
1 changed files with 14 additions and 3 deletions

17
xumu.py
View File

@ -31,6 +31,11 @@ class DataQuery(BaseModel):
deviceId: str
# RFID查询参数实体
class RFIDQuery(BaseModel):
rfid: str
# 数据查询接口
@app.post("/api/xumu/data/query")
async def data_query(params: DataQuery):
@ -56,6 +61,14 @@ async def rest_query(request: Request):
return BaseResponse(data=r.json())
# RFID查询接口
@app.post("/api/xumu/rfid/query")
async def rest_query(rfid_query: RFIDQuery):
rfid = rfid_query.rfid
pass
# 设备查询接口
@app.post("/api/xumu/device/query")
async def get_device(device: Device):
@ -67,9 +80,6 @@ async def get_device(device: Device):
# 检查deviceId是否有值如果有添加到SQL语句中
if device.deviceId:
sql += f" and deviceId = '{device.deviceId}'"
# 检查type是否有值如果有添加到SQL语句中
if device.type is not None:
sql += f" and type = {device.type}"
send_json = {
"sql": sql
}
@ -147,6 +157,7 @@ async def process_data(request: Request):
m = payload["m"]
v = payload["v"]
t = payload["t"]
# TODO 判断t是否为00 则代表是RFID设备需要做一个映射
cid = v[0]
m.append("t")
v.append(t)