提交代码调整。

This commit is contained in:
liuwei
2025-04-22 15:04:00 +08:00
parent f34c1db686
commit ace81ce645
9 changed files with 4753 additions and 101 deletions

View File

@@ -234,7 +234,6 @@ class ContactManager:
# "province": cnt.get("province", ""),
# "city": cnt.get("city", ""),
# "gender": gender}
self._friends = self.message_util.get_friends()
self._logger.info(f"联系人信息已刷新,共 {len(new_contacts)} 个联系人")
self._classify_contacts()

View File

@@ -134,19 +134,18 @@ class MessageStorage:
# 解析JSON
if json and json.get('data') and json['data'].get('fileUrl'):
file_url = json['data']['fileUrl']
download_path = self.download_file_from_url(file_url, target_dir)
if download_path:
logger.info(f"使用wcf下载图片成功: {msg.msg_id} -> {download_path}")
if file_url:
logger.info(f"记录gewe服务端图片路径成功: {msg.msg_id} -> {file_url}")
# 后续如果需要使用,则去服务器端提取图片
# 直接使用下载后的路径更新数据库
self.message_db.update_message_image_path(msg.msg_id, download_path)
self.message_db.update_message_image_path(msg.msg_id, file_url)
return {
'success': True,
'message_id': msg.msg_id,
'roomid': msg.roomid,
'sender': msg.sender,
'file_path': download_path
'file_path': file_url
}
else:
return {
@@ -162,7 +161,7 @@ class MessageStorage:
'message_id': msg.msg_id,
'roomid': msg.roomid,
'sender': msg.sender,
'error': "WCF实例不存在或消息ID无效"
'error': "实例不存在或消息ID无效"
}
except Exception as e:
logger.error(f"图片处理出错: {msg.msg_id}, 错误: {e}")
@@ -174,10 +173,6 @@ class MessageStorage:
'error': str(e)
}
def download_file_from_url(self, url: str, target_dir: str) -> str:
# TODO 根据获取的文件地址从server 下载 http://{服务ip}:2532/download/{接口返回的文件路径}
return ""
def _process_image_callback(self, future):
"""处理异步图片处理任务完成后的回调"""
try: