update
This commit is contained in:
parent
c0dd49875d
commit
7d78859fd6
8
xumu.py
8
xumu.py
|
@ -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))
|
||||||
|
|
Loading…
Reference in New Issue