From d58077f58b88fc4761c01c42df9b3f26e2994669 Mon Sep 17 00:00:00 2001 From: aoxuan Date: Wed, 11 Jun 2025 22:26:44 +0800 Subject: [PATCH] =?UTF-8?q?fix(app):=20=E4=BF=AE=E5=A4=8D=E4=BC=81?= =?UTF-8?q?=E4=B8=9A=E5=BE=AE=E4=BF=A1=E6=9C=BA=E5=99=A8=E4=BA=BA=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E6=8E=A8=E9=80=81=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除了不必要的变量 final_image_path -直接使用 image_path 进行图片存在性检查 - 更新了图片 base64 和 md5计算的逻辑 --- app/services/notification.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/services/notification.py b/app/services/notification.py index d5e17e9..b4acf4d 100644 --- a/app/services/notification.py +++ b/app/services/notification.py @@ -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(