This commit is contained in:
xyj 2024-01-25 15:01:20 +08:00
parent 8eaad30295
commit 4c035d7b05
1 changed files with 4 additions and 6 deletions

10
xumu.py
View File

@ -37,10 +37,9 @@ class RFIDQuery(BaseModel):
# 数据查询接口
@app.post("/api/xumu/data/query")
async def data_query(params: DataQuery):
@app.get("/api/xumu/data/query")
async def data_query(deviceId):
try:
deviceId = params.deviceId
if deviceId is None or deviceId == "" or len(deviceId) != 4:
return BaseResponse(code=500, msg="参数错误")
sql = f"select last * from root.farm.{deviceId}"
@ -62,10 +61,9 @@ async def rest_query(request: Request):
# RFID查询接口
@app.post("/api/xumu/rfid/query")
async def rfid_query(rfid_entity: RFIDQuery):
@app.get("/api/xumu/rfid/query")
async def rfid_query(rfid):
try:
rfid = rfid_entity.rfid
sql = f"select deviceId from root.rfid where rfid='{rfid}'"
send_json = {
"sql": sql