From 7108cb6c569c6f7dc876bff585fabb466f278489 Mon Sep 17 00:00:00 2001 From: haotian <2421912570@qq.com> Date: Thu, 12 Jun 2025 14:59:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9--=E4=BF=AE=E6=94=B9=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E7=9B=91=E6=8E=A7=E8=A7=86=E9=A2=91=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F,=E4=BF=AE=E6=94=B9=E5=90=8C=E6=AD=A5?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/v1/endpoints/events.py | 74 +++++++++++++++++++++---------- app/services/websocket_service.py | 6 +-- change_log.md | 14 ++++++ run_sync.py | 4 +- 4 files changed, 69 insertions(+), 29 deletions(-) diff --git a/app/api/v1/endpoints/events.py b/app/api/v1/endpoints/events.py index ef8e43b..52cc4df 100644 --- a/app/api/v1/endpoints/events.py +++ b/app/api/v1/endpoints/events.py @@ -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]) diff --git a/app/services/websocket_service.py b/app/services/websocket_service.py index 9a441bf..9e88ad7 100644 --- a/app/services/websocket_service.py +++ b/app/services/websocket_service.py @@ -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) diff --git a/change_log.md b/change_log.md index cc7ba5a..49eed66 100644 --- a/change_log.md +++ b/change_log.md @@ -25,3 +25,17 @@ - 添加 /events/getEtypeNameList 接口, 获取事件类型下拉框 - task实体类添加 taskName字段 - 添加 /events/robotTask接口, 获取机器人任务列表. + +# 20250610 + +- 修改同步数据库方法 + +# 20250611 + +- 修改同步数据库方法 +- 修改返回监控及机器人视角返回参数 + +# 20250612 + +- 修改返回监控视频参数格式 +- 修改同步数据方法 diff --git a/run_sync.py b/run_sync.py index 90b42eb..baedfac 100644 --- a/run_sync.py +++ b/run_sync.py @@ -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")) \ No newline at end of file + asyncio.run(run_sync()) + # asyncio.run(run_sync_event("ac0278e8384e4025b202871df9c1a1d8")) \ No newline at end of file