From 43d6792926e25dc940b6904acc8ab010e5e43f05 Mon Sep 17 00:00:00 2001 From: SiYuan <863909694@qq.com> Date: Tue, 27 Feb 2024 16:40:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Ecsv=E5=8F=91=E9=80=81?= =?UTF-8?q?=E8=80=85=E3=80=81=E6=8E=A5=E5=8F=97=E8=80=85=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/util/exporter/exporter_csv.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/util/exporter/exporter_csv.py b/app/util/exporter/exporter_csv.py index 42d6803..0a1ca60 100644 --- a/app/util/exporter/exporter_csv.py +++ b/app/util/exporter/exporter_csv.py @@ -2,6 +2,7 @@ import csv import os from app.DataBase import msg_db +from app.person import Me from app.util.exporter.exporter import ExporterBase from app.config import OUTPUT_DIR @@ -23,7 +24,14 @@ class CSVExporter(ExporterBase): # 写入数据 # writer.writerows(messages) for msg in messages: - other_data = [msg[13].remark, msg[13].nickName, msg[13].wxid] if self.contact.is_chatroom else [] + if self.contact.is_chatroom: + other_data = [msg[13].remark, msg[13].nickName, msg[13].wxid] + else: + is_send = msg[4] + Remark = Me().remark if is_send else self.contact.remark + nickname = Me().nickName if is_send else self.contact.nickName + wxid = Me().wxid if is_send else self.contact.wxid + other_data = [Remark,nickname,wxid] writer.writerow([*msg[:9], *other_data]) print(f"【完成导出 CSV {self.contact.remark}】") self.okSignal.emit(1)