This commit is contained in:
xyj 2024-02-20 15:14:10 +08:00
parent c0dd49875d
commit 7d78859fd6
1 changed files with 5 additions and 3 deletions

View File

@ -27,16 +27,18 @@ async def video_query(username):
# 报警数据接口 # 报警数据接口
@app.get("/api/xumu/warning") @app.get("/api/xumu/warning")
async def get_warning(deviceId): async def get_warning(deviceId, limit, offset):
try: try:
sql = f"select * from root.warning.{deviceId}" sql = f"select * from root.warning.{deviceId}"
if limit:
sql += f" limit {limit}"
if offset:
sql += f" offset {offset}"
# 检查iccid是否有值如果有添加到SQL语句中 # 检查iccid是否有值如果有添加到SQL语句中
send_json = { send_json = {
"sql": sql "sql": sql
} }
r = requests.post(baseHost + queryUri, headers=headers, json=send_json) r = requests.post(baseHost + queryUri, headers=headers, json=send_json)
data = r.json()
return BaseResponse(data=r.json()) return BaseResponse(data=r.json())
except Exception as e: except Exception as e:
return BaseResponse(code=500, msg=str(e)) return BaseResponse(code=500, msg=str(e))