修改--修改返回监控视频参数格式,修改同步数据方法

This commit is contained in:
haotian 2025-06-12 14:59:00 +08:00
parent bcc3a07334
commit 7108cb6c56
4 changed files with 69 additions and 29 deletions

View File

@ -373,31 +373,57 @@ async def get_alert_count(
async def get_monitor():
t = {
"厂区监控":{
"A区厂区监控":[
"https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8",
"https://play.livejinan.cn/21ZoxrLa/45ee42a7b9d64400963d6bacc9a75867.m3u8?auth_key=1893340800-0-0-3522915cd5471437682295596e73cac2"
],
"B区厂区监控":[
"https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8",
""
],
"C区厂区监控":[
"https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8",
"https://play.livejinan.cn/21ZoxrLa/45ee42a7b9d64400963d6bacc9a75867.m3u8?auth_key=1893340800-0-0-3522915cd5471437682295596e73cac2"
]
},
"追随机器人监控1":{
"追随机器人1":[
"https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8",
"https://play.livejinan.cn/21ZoxrLa/45ee42a7b9d64400963d6bacc9a75867.m3u8?auth_key=1893340800-0-0-3522915cd5471437682295596e73cac2"
],
"追随机器人2":[
"https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8",
"https://play.livejinan.cn/21ZoxrLa/45ee42a7b9d64400963d6bacc9a75867.m3u8?auth_key=1893340800-0-0-3522915cd5471437682295596e73cac2"
]
},
"追随机器人监控2":{
"追随机器人1":[
"https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8",
"https://play.livejinan.cn/21ZoxrLa/45ee42a7b9d64400963d6bacc9a75867.m3u8?auth_key=1893340800-0-0-3522915cd5471437682295596e73cac2"
],
"追随机器人2":[
"https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8",
"https://play.livejinan.cn/21ZoxrLa/45ee42a7b9d64400963d6bacc9a75867.m3u8?auth_key=1893340800-0-0-3522915cd5471437682295596e73cac2"
]
},
"robot":{
"robot1":[
"webrtc://qvs-live.thirdmonitor.concoai.com:447/2xenzwqy2ppcl/31011500991180041301_34020000001320000001",
"webrtc://qvs-live.thirdmonitor.concoai.com:447/2xenzwqy2ppcl/31011500991180041302_34020000001320000002",
"webrtc://qvs-live.thirdmonitor.concoai.com:447/2xenzwqy2ppcl/31011500991180041302_34020000001320000001"
],
"robot2":[
"webrtc://qvs-live.thirdmonitor.concoai.com:447/2xenzwqy2ppcl/31011500991180041301_34020000001320000001",
"webrtc://qvs-live.thirdmonitor.concoai.com:447/2xenzwqy2ppcl/31011500991180041302_34020000001320000002",
"webrtc://qvs-live.thirdmonitor.concoai.com:447/2xenzwqy2ppcl/31011500991180041302_34020000001320000001"
]
},
}
return BaseResponse(code=200, msg="success"
,data={
"A区厂区监控":{
"视角1": "https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8",
"视角2": "https://play.livejinan.cn/21ZoxrLa/45ee42a7b9d64400963d6bacc9a75867.m3u8?auth_key=1893340800-0-0-3522915cd5471437682295596e73cac2"
},
"B区厂区监控":{
"视角1": "https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8",
"视角2": ""
},
"追随机器人监控":{
"视角1": "https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8",
"视角2": "https://play.livejinan.cn/21ZoxrLa/45ee42a7b9d64400963d6bacc9a75867.m3u8?auth_key=1893340800-0-0-3522915cd5471437682295596e73cac2"
},
"室外机器人监控":{
"热成像": "webrtc://qvs-live.thirdmonitor.concoai.com:447/2xenzwqy2ppcl/31011500991180041301_34020000001320000001",
"主监控": "webrtc://qvs-live.thirdmonitor.concoai.com:447/2xenzwqy2ppcl/31011500991180041302_34020000001320000002",
"前置摄像头":"webrtc://qvs-live.thirdmonitor.concoai.com:447/2xenzwqy2ppcl/31011500991180041302_34020000001320000001"
}
}
)
return BaseResponse(code=200, msg="success",data=t)
# 获取机器人统计信息
@router.get("/events/robotST", response_model=BaseResponse[dict])

View File

@ -60,7 +60,7 @@ class WebSocketClient:
# async with aiofiles.open(filename, 'w', encoding='utf-8') as f:
# await f.write(json.dumps(messages, ensure_ascii=False, indent=2))
print(f"消息已保存到文件: {filename}")
# print(f"消息已保存到文件: {filename}")
except Exception as e:
print(f"保存消息时出错: {str(e)}")
@ -82,8 +82,8 @@ class WebSocketClient:
# 机器人状态消息
elif self._process_robot_status(message_dict):
print("处理机器人状态消息...")
print(f"{datetime.now()}收到消息: {message}") # 只打印前100个字符
# print("处理机器人状态消息...")
# print(f"{datetime.now()}收到消息: {message}") # 只打印前100个字符
await self.event_sync_service.sync_robot_status(message_dict)
# await run_sync_event(t)

View File

@ -25,3 +25,17 @@
- 添加 /events/getEtypeNameList 接口, 获取事件类型下拉框
- task实体类添加 taskName字段
- 添加 /events/robotTask接口, 获取机器人任务列表.
# 20250610
- 修改同步数据库方法
# 20250611
- 修改同步数据库方法
- 修改返回监控及机器人视角返回参数
# 20250612
- 修改返回监控视频参数格式
- 修改同步数据方法

View File

@ -7,5 +7,5 @@ from app.services.event_sync_service import run_sync, run_sync_event
if __name__ == "__main__":
print("启动事件同步服务...")
# asyncio.run(run_sync())
asyncio.run(run_sync_event("ac0278e8384e4025b202871df9c1a1d8"))
asyncio.run(run_sync())
# asyncio.run(run_sync_event("ac0278e8384e4025b202871df9c1a1d8"))