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