diff --git a/xumu.py b/xumu.py index 247346d..411f290 100644 --- a/xumu.py +++ b/xumu.py @@ -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是否为0,0 则代表是RFID设备,需要做一个映射 cid = v[0] m.append("t") v.append(t)