修改bug

This commit is contained in:
haotian 2025-05-29 10:26:10 +08:00
parent d1563215d7
commit bfc8ccaccf
2 changed files with 8 additions and 1 deletions

View File

@ -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

View File

@ -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"))
asyncio.run(run_sync_event("55ec55e886474b4f93390e71ea46c64d"))