From 7d78859fd63d25d2d9331713982cf734607e52b0 Mon Sep 17 00:00:00 2001 From: xyj <10908227994@qq.com> Date: Tue, 20 Feb 2024 15:14:10 +0800 Subject: [PATCH] update --- xumu.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/xumu.py b/xumu.py index 0bfb23b..90d9595 100644 --- a/xumu.py +++ b/xumu.py @@ -27,16 +27,18 @@ async def video_query(username): # 报警数据接口 @app.get("/api/xumu/warning") -async def get_warning(deviceId): +async def get_warning(deviceId, limit, offset): try: sql = f"select * from root.warning.{deviceId}" + if limit: + sql += f" limit {limit}" + if offset: + sql += f" offset {offset}" # 检查iccid是否有值,如果有,添加到SQL语句中 send_json = { "sql": sql } r = requests.post(baseHost + queryUri, headers=headers, json=send_json) - data = r.json() - return BaseResponse(data=r.json()) except Exception as e: return BaseResponse(code=500, msg=str(e))