This commit is contained in:
xyj 2024-01-26 16:54:19 +08:00
parent 7d16f0ea1d
commit b63c68e1f8
1 changed files with 20 additions and 0 deletions

20
xumu.py
View File

@ -19,11 +19,31 @@ class BaseResponse(BaseModel):
data: Any = None
# 监控视频接口
@app.get("/api/xumu/video")
async def data_query(username):
return BaseResponse(data=get_video_url(username))
@app.get("/api/xumu/device/online")
async def device_online_query(iccid, deviceId):
try:
sql = "select is_online from root.farm.clientId where time >= 0"
# 检查iccid是否有值如果有添加到SQL语句中
if iccid:
sql += f" and iccid = '{iccid}'"
# 检查deviceId是否有值如果有添加到SQL语句中
if deviceId:
sql += f" and deviceId = '{deviceId}'"
send_json = {
"sql": sql
}
r = requests.post(baseHost + queryUri, headers=headers, json=send_json)
return BaseResponse(data=r.json())
except Exception as e:
return BaseResponse(code=500, msg=str(e))
# 数据查询接口
@app.get("/api/xumu/data/query")
async def data_query(deviceId):