修改--修改同步功能
This commit is contained in:
parent
8cb5a9db5b
commit
bcc3a07334
@ -134,6 +134,8 @@ class EventSyncService:
|
||||
session.add(new_event)
|
||||
await session.commit()
|
||||
|
||||
|
||||
|
||||
detail["imgList"] = t
|
||||
# 保存图片信息
|
||||
image_list = await self._save_images(session, detail)
|
||||
|
||||
@ -77,11 +77,13 @@ class WebSocketClient:
|
||||
# 检查是否需要触发事件同步
|
||||
if self._should_trigger_sync(message_dict):
|
||||
print("触发事件同步...")
|
||||
print(f"{datetime.now()}收到消息: {message}") # 只打印前100个字符
|
||||
await self.event_sync_service.sync_event(message_dict.get("eventId"))
|
||||
|
||||
# 机器人状态消息
|
||||
elif self._process_robot_status(message_dict):
|
||||
print("处理机器人状态消息...")
|
||||
print(f"{datetime.now()}收到消息: {message}") # 只打印前100个字符
|
||||
await self.event_sync_service.sync_robot_status(message_dict)
|
||||
|
||||
# await run_sync_event(t)
|
||||
@ -126,7 +128,7 @@ class WebSocketClient:
|
||||
try:
|
||||
# 接收消息
|
||||
message = await websocket.recv()
|
||||
print(f"{datetime.now()}收到消息: {message}...") # 只打印前100个字符
|
||||
|
||||
|
||||
# 处理消息
|
||||
await self.process_message(message)
|
||||
|
||||
@ -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("f3a4951618334c7dafef03ad5345a3c1"))
|
||||
# asyncio.run(run_sync())
|
||||
asyncio.run(run_sync_event("ac0278e8384e4025b202871df9c1a1d8"))
|
||||
Loading…
Reference in New Issue
Block a user