update
This commit is contained in:
parent
7d16f0ea1d
commit
b63c68e1f8
20
xumu.py
20
xumu.py
|
@ -19,11 +19,31 @@ class BaseResponse(BaseModel):
|
||||||
data: Any = None
|
data: Any = None
|
||||||
|
|
||||||
|
|
||||||
|
# 监控视频接口
|
||||||
@app.get("/api/xumu/video")
|
@app.get("/api/xumu/video")
|
||||||
async def data_query(username):
|
async def data_query(username):
|
||||||
return BaseResponse(data=get_video_url(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")
|
@app.get("/api/xumu/data/query")
|
||||||
async def data_query(deviceId):
|
async def data_query(deviceId):
|
||||||
|
|
Loading…
Reference in New Issue