fix(app): 修复企业微信机器人图片推送异常

- 移除了不必要的变量 final_image_path
-直接使用 image_path 进行图片存在性检查
- 更新了图片 base64 和 md5计算的逻辑
This commit is contained in:
2025-06-11 22:26:44 +08:00
parent 4d4d6dbedf
commit d58077f58b

View File

@@ -277,10 +277,10 @@ class Notification(QObject):
"""使用企业微信群机器人推送图片通知"""
try:
# 压缩图片
final_image_path = ImageUtils.compress_image_if_needed(image_path)
ImageUtils.compress_image_if_needed(image_path)
# 检查图片是否存在
if not final_image_path.exists():
if not image_path.exists():
logger.error(
"图片推送异常 | 图片不存在或者压缩失败,请检查图片路径是否正确"
)
@@ -304,8 +304,8 @@ class Notification(QObject):
# 获取图片base64和md5
try:
image_base64 = ImageUtils.get_base64_from_file(str(final_image_path))
image_md5 = ImageUtils.calculate_md5_from_file(str(final_image_path))
image_base64 = ImageUtils.get_base64_from_file(str(image_path))
image_md5 = ImageUtils.calculate_md5_from_file(str(image_path))
except Exception as e:
logger.error(f"图片编码或MD5计算失败{e}")
self.push_info_bar.emit(