From d651170114fc2a9d3526e62bd4e8fde1045ecd65 Mon Sep 17 00:00:00 2001 From: liuwei Date: Mon, 28 Apr 2025 13:48:40 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=96=B0=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- robot.py | 5 ++--- utils/wechat/message_to_db.py | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/robot.py b/robot.py index 049a415..c52b98d 100644 --- a/robot.py +++ b/robot.py @@ -194,8 +194,7 @@ class Robot(Job): # 添加到数据库 # 这里假设 contacts_db 有 save_contact_info 方法,参数为 dict resp = self.client.get_chatroom_member_detail(self.app_id, msg.roomid, [wxid]) - resp_obj = json_to_object(resp) - infos = resp_obj.data + infos = resp.get('data', {}) for info in infos: self.LOG.info(f"已添加新用户信息到数据库: {wxid}") # 更新缓存 @@ -224,7 +223,7 @@ class Robot(Job): except Exception as e: self.LOG.error(f"process_message error: {e}") - # # 聊天记录入库动作: + # # 聊天记录入库动作: try: self.message_storage.archive_message(msg) # 单独处理图片消息 后续写定时任务自动完成下载。延时处理。 diff --git a/utils/wechat/message_to_db.py b/utils/wechat/message_to_db.py index e21d472..4fba756 100644 --- a/utils/wechat/message_to_db.py +++ b/utils/wechat/message_to_db.py @@ -131,7 +131,7 @@ class MessageStorage: # "fileUrl": "/download/20240720/wx_BTVoJ_o_r6DpxNCNiycFE/0ca5b675-8e2c-4dc1-b288-3c44a40086ec4" # } # } - # 解析JSON + # 解析JSON http://192.168.2.240:2532/download/20250428/wx_3BC6eSHGE5xEm_hH3__7c/03ab5c03-5524-4a39-aabe-27ca014a4d1e.png if json and json.get('data') and json['data'].get('fileUrl'): file_url = json['data']['fileUrl'] if file_url: