From 7a7ed1ae75ce1f6edf5548d170e9b312a6a16d06 Mon Sep 17 00:00:00 2001
From: shuaikangzhou <863909694@qq.com>
Date: Sat, 25 Nov 2023 00:40:09 +0800
Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4pandas?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.idea/workspace.xml | 33 ++++++++-----------
app/DataBase/output_pc.py | 44 +++++++++++++++----------
app/ui_pc/tool/pc_decrypt/pc_decrypt.py | 2 ++
requirements_pc.txt | 11 +++++++
4 files changed, 53 insertions(+), 37 deletions(-)
create mode 100644 requirements_pc.txt
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 1c4f215..9574c55 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,16 +4,10 @@
-
+
+
-
-
-
-
-
-
-
-
+
@@ -26,6 +20,7 @@
+
@@ -273,13 +268,6 @@
1672848140146
-
- 1698940208580
-
-
-
- 1698940208580
-
1699025065814
@@ -616,7 +604,14 @@
1700840978590
-
+
+ 1700842837452
+
+
+
+ 1700842837452
+
+
@@ -652,7 +647,6 @@
-
@@ -677,7 +671,8 @@
-
+
+
diff --git a/app/DataBase/output_pc.py b/app/DataBase/output_pc.py
index 7bcb831..f085765 100644
--- a/app/DataBase/output_pc.py
+++ b/app/DataBase/output_pc.py
@@ -1,6 +1,6 @@
+import csv
import os
-import pandas as pd
from PyQt5.QtCore import pyqtSignal, QThread
from . import msg
@@ -36,21 +36,7 @@ class Output(QThread):
@log
def to_csv(self, conRemark, path):
- origin_docx_path = f"{os.path.abspath('.')}/data/聊天记录/{self.contact.remark}"
- if not os.path.exists(origin_docx_path):
- os.mkdir(origin_docx_path)
- filename = f"{os.path.abspath('.')}/data/聊天记录/{self.contact.remark}/{self.contact.remark}.csv"
- # columns = ["用户名", "消息内容", "发送时间", "发送状态", "消息类型", "isSend", "msgId"]
- columns = ['localId', 'TalkerId', 'Type', 'SubType',
- 'IsSender', 'CreateTime', 'Status', 'StrContent',
- 'StrTime']
- messages = msg.get_messages(self.contact.wxid)
- # print()
- df = pd.DataFrame(
- data=messages,
- columns=columns,
- )
- df.to_csv(filename, encoding='utf-8')
+
self.okSignal.emit('ok')
def to_html(self):
@@ -72,7 +58,11 @@ class Output(QThread):
return
elif self.output_type == self.CSV:
# print("线程导出csv")
- self.to_csv(self.ta_username, "path")
+ self.Child0 = ChildThread(self.contact, type_=ChildThread.CSV)
+ self.Child0.progressSignal.connect(self.progress)
+ self.Child0.rangeSignal.connect(self.rangeSignal)
+ self.Child0.okSignal.connect(self.okSignal)
+ self.Child0.run()
elif self.output_type == self.HTML:
# self.to_html()
self.Child0 = ChildThread(self.contact, type_=ChildThread.HTML)
@@ -134,6 +124,24 @@ class ChildThread(QThread):
def video(self, doc, isSend, content, status, img_path):
return
+ def to_csv(self):
+ origin_docx_path = f"{os.path.abspath('.')}/data/聊天记录/{self.contact.remark}"
+ if not os.path.exists(origin_docx_path):
+ os.mkdir(origin_docx_path)
+ filename = f"{os.path.abspath('.')}/data/聊天记录/{self.contact.remark}/{self.contact.remark}.csv"
+ # columns = ["用户名", "消息内容", "发送时间", "发送状态", "消息类型", "isSend", "msgId"]
+ columns = ['localId', 'TalkerId', 'Type', 'SubType',
+ 'IsSender', 'CreateTime', 'Status', 'StrContent',
+ 'StrTime']
+ messages = msg.get_messages(self.contact.wxid)
+ # 写入CSV文件
+ with open(filename, mode='w', newline='', encoding='utf-8') as file:
+ writer = csv.writer(file)
+ writer.writerow(columns)
+ # 写入数据
+ writer.writerows(messages)
+ self.okSignal.emit('ok')
+
def to_html(self):
origin_docx_path = f"{os.path.abspath('.')}/data/聊天记录/{self.contact.remark}"
if not os.path.exists(origin_docx_path):
@@ -729,6 +737,6 @@ const chatMessages = [
if self.output_type == self.DOCX:
return
elif self.output_type == self.CSV:
- return
+ self.to_csv()
elif self.output_type == self.HTML:
self.to_html_()
diff --git a/app/ui_pc/tool/pc_decrypt/pc_decrypt.py b/app/ui_pc/tool/pc_decrypt/pc_decrypt.py
index 160afe5..5e5dffd 100644
--- a/app/ui_pc/tool/pc_decrypt/pc_decrypt.py
+++ b/app/ui_pc/tool/pc_decrypt/pc_decrypt.py
@@ -151,6 +151,8 @@ class DecryptControl(QWidget, decryptUi.Ui_Dialog):
'mobile': self.info['mobile']
}
try:
+ if not os.path.exists('./app/data'):
+ os.mkdir('./app/data')
with open('./app/data/info.json', 'w', encoding='utf-8') as f:
f.write(json.dumps(dic))
except:
diff --git a/requirements_pc.txt b/requirements_pc.txt
new file mode 100644
index 0000000..d75a8e2
--- /dev/null
+++ b/requirements_pc.txt
@@ -0,0 +1,11 @@
+PyQt5
+psutil
+pycryptodomex
+pywin32
+pymem
+silk-python
+pyaudio
+fuzzywuzzy
+python-Levenshtein
+pillow
+requests