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: