From aebd5fbdb1250ac4a1c77e4967060b58342e463c Mon Sep 17 00:00:00 2001 From: SiYuan <863909694@qq.com> Date: Sat, 10 Feb 2024 00:53:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=BD=AC=E8=B4=A6=E8=A7=A3?= =?UTF-8?q?=E6=9E=90=E9=94=99=E8=AF=AF=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/util/exporter/exporter_html.py | 20 +++++++++++--------- app/web_ui/templates/christmas.html | 8 +------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/app/util/exporter/exporter_html.py b/app/util/exporter/exporter_html.py index 5b55491..d7b3c3d 100644 --- a/app/util/exporter/exporter_html.py +++ b/app/util/exporter/exporter_html.py @@ -270,15 +270,17 @@ class HtmlExporter(ExporterBase): is_chatroom = 1 if self.contact.is_chatroom else 0 avatar = self.get_avatar_path(is_send, message) display_name = self.get_display_name(is_send, message) - text_info_map = { - 1: transfer_detail["pay_memo"] or "转账", - 3: "已收款", - 4: "已退还", - 7: "未知", - } - doc.write( - f"""{{ type:49, sub_type:2000,text:'{text_info_map[transfer_detail["paysubtype"]]}',is_send:{is_send},avatar_path:'{avatar}',timestamp:{timestamp},is_chatroom:{is_chatroom},displayname:'{display_name}',paysubtype:{transfer_detail["paysubtype"]},pay_memo:'{transfer_detail["pay_memo"]}',feedesc:'{transfer_detail["feedesc"]}',}},\n""") - + try: + text_info_map = { + 1: transfer_detail["pay_memo"] or "转账", + 3: "已收款", + 4: "已退还", + 7: "未知", + } + doc.write( + f"""{{ type:49, sub_type:2000,text:'{text_info_map[transfer_detail["paysubtype"]]}',is_send:{is_send},avatar_path:'{avatar}',timestamp:{timestamp},is_chatroom:{is_chatroom},displayname:'{display_name}',paysubtype:{transfer_detail["paysubtype"]},pay_memo:'{transfer_detail["pay_memo"]}',feedesc:'{transfer_detail["feedesc"]}',}},\n""") + except Exception as e: + logger.error(f'转账解析错误:{transfer_detail}\n{traceback.format_exc()}') def call(self, doc, message): is_send = message[4] timestamp = message[5] diff --git a/app/web_ui/templates/christmas.html b/app/web_ui/templates/christmas.html index 5361bb1..d06731c 100644 --- a/app/web_ui/templates/christmas.html +++ b/app/web_ui/templates/christmas.html @@ -230,13 +230,7 @@