diff --git a/app/services/event_sync_service.py b/app/services/event_sync_service.py index 5183809..ec8d79d 100644 --- a/app/services/event_sync_service.py +++ b/app/services/event_sync_service.py @@ -53,11 +53,16 @@ class EventSyncService: continue try: + # 当imgList中有多个imgurl时,不能直接插入event表 + t = detail["imgList"] + detail["imgList"] = ",".join(detail["imgList"]) + # 更新事件信息 new_event = Event(**detail) session.add(new_event) await session.commit() + detail["imgList"] = t # 保存图片信息 image_list = await self._save_images(session, detail) @@ -194,6 +199,7 @@ class EventSyncService: # 异常消息 if status.value != 0: + print("发送异常消息") message = Message( eventId = image.eventId, messageType = status.value, @@ -203,6 +209,7 @@ class EventSyncService: try: await session.commit() except Exception as e: + print("插入Temperature表数据异常") raise diff --git a/run_sync.py b/run_sync.py index a59a305..f2be188 100644 --- a/run_sync.py +++ b/run_sync.py @@ -8,4 +8,4 @@ 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("95279ebe957f4a2bb919883f9e2fad24")) \ No newline at end of file + asyncio.run(run_sync_event("55ec55e886474b4f93390e71ea46c64d")) \ No newline at end of file