mirror of
https://github.com/LC044/WeChatMsg
synced 2025-02-21 01:52:35 +08:00
修复一些问题
This commit is contained in:
parent
40c57c5891
commit
ad25b4550c
@ -10,8 +10,6 @@
|
||||
from .hard_link import HardLink
|
||||
from .micro_msg import MicroMsg
|
||||
from .media_msg import MediaMsg
|
||||
# from . import data
|
||||
# from . import output
|
||||
from .misc import Misc
|
||||
from .msg import Msg
|
||||
from .msg import MsgType
|
||||
@ -31,4 +29,12 @@ def close_db():
|
||||
media_msg_db.close()
|
||||
|
||||
|
||||
def init_db():
|
||||
misc_db.init_database()
|
||||
msg_db.init_database()
|
||||
micro_msg_db.init_database()
|
||||
hard_link_db.init_database()
|
||||
media_msg_db.init_database()
|
||||
|
||||
|
||||
__all__ = ['output', 'misc_db', 'micro_msg_db', 'msg_db', 'hard_link_db', 'MsgType', "media_msg_db"]
|
||||
|
@ -206,8 +206,8 @@ class Msg:
|
||||
('', '', ['', ''], ''),
|
||||
('', '', '', '')
|
||||
))
|
||||
print(keyword,res)
|
||||
return res
|
||||
|
||||
def get_contact(self, contacts):
|
||||
if not self.open_flag:
|
||||
return None
|
||||
@ -227,6 +227,7 @@ class Msg:
|
||||
contacts[i].append(0)
|
||||
contacts.sort(key=lambda cur_contact: cur_contact[-1], reverse=True)
|
||||
return contacts
|
||||
|
||||
def get_messages_by_days(self, username_, is_Annual_report_=False, year_='2023'):
|
||||
if is_Annual_report_:
|
||||
sql = '''
|
||||
@ -375,7 +376,7 @@ if __name__ == '__main__':
|
||||
msg.init_database()
|
||||
result = msg.get_message_by_num('wxid_vtz9jk9ulzjt22', 9999999)
|
||||
print(result)
|
||||
result = msg.get_messages_by_type('wxid_vtz9jk9ulzjt22',49)
|
||||
result = msg.get_messages_by_type('wxid_vtz9jk9ulzjt22', 49)
|
||||
for r in result:
|
||||
type_ = r[2]
|
||||
sub_type = r[3]
|
||||
|
@ -259,7 +259,6 @@ class ChildThread(QThread):
|
||||
f'''{str_time} {name}\n[语音]\n\n'''
|
||||
)
|
||||
|
||||
|
||||
def emoji(self, doc, message):
|
||||
origin_docx_path = f"{os.path.abspath('.')}/data/聊天记录/{self.contact.remark}"
|
||||
str_content = message[7]
|
||||
@ -289,7 +288,7 @@ class ChildThread(QThread):
|
||||
def retract_message(self, doc, isSend, content, status):
|
||||
return
|
||||
|
||||
def refermsg(self, doc,message):
|
||||
def refermsg(self, doc, message):
|
||||
"""
|
||||
处理回复消息
|
||||
@param doc:
|
||||
@ -322,7 +321,7 @@ class ChildThread(QThread):
|
||||
doc.write(
|
||||
f'''{{ type:49, text: '{contentText}',is_send:{is_send},sub_type:{content.get('type')},avatar_path:'{avatar}'}},'''
|
||||
)
|
||||
elif self.output_type==Output.TXT:
|
||||
elif self.output_type == Output.TXT:
|
||||
name = '你' if is_send else self.contact.remark
|
||||
if refer_msg:
|
||||
doc.write(
|
||||
@ -333,7 +332,6 @@ class ChildThread(QThread):
|
||||
f'''{str_time} {name}\n{content.get('title')}\n引用:未知\n\n'''
|
||||
)
|
||||
|
||||
|
||||
def system_msg(self, doc, message):
|
||||
str_content = message[7]
|
||||
is_send = message[4]
|
||||
@ -455,7 +453,7 @@ class ChildThread(QThread):
|
||||
elif type_ == 10000 and self.message_types.get(type_):
|
||||
self.system_msg(f, message)
|
||||
elif type_ == 49 and sub_type == 57:
|
||||
self.refermsg(f,message)
|
||||
self.refermsg(f, message)
|
||||
f.write(html_end)
|
||||
f.close()
|
||||
self.okSignal.emit(1)
|
||||
@ -486,6 +484,7 @@ class ChildThread(QThread):
|
||||
elif type_ == 49 and sub_type == 57:
|
||||
self.refermsg(f, message)
|
||||
self.okSignal.emit(1)
|
||||
|
||||
def run(self):
|
||||
if self.output_type == Output.DOCX:
|
||||
return
|
||||
|
@ -3,6 +3,7 @@ from collections import Counter
|
||||
from PyQt5.QtCore import QFile, QTextStream, QIODevice
|
||||
|
||||
import sys
|
||||
|
||||
sys.path.append('.')
|
||||
|
||||
from app.DataBase import msg_db, MsgType
|
||||
@ -22,13 +23,13 @@ def wordcloud(wxid, is_Annual_report=False, year='2023', who='1'):
|
||||
txt_messages = msg_db.get_messages_by_type(wxid, MsgType.TEXT, is_Annual_report, year)
|
||||
if not txt_messages:
|
||||
return {
|
||||
'chart_data': None,
|
||||
'keyword': "没有聊天你想分析啥",
|
||||
'max_num': "0",
|
||||
'dialogs': []
|
||||
}
|
||||
'chart_data': None,
|
||||
'keyword': "没有聊天你想分析啥",
|
||||
'max_num': "0",
|
||||
'dialogs': []
|
||||
}
|
||||
# text = ''.join(map(lambda x: x[7], txt_messages))
|
||||
text = ''.join(map(lambda x: x[7] if x[4] == int(who) else '', txt_messages)) # 1“我”说的话,0“Ta”说的话
|
||||
text = ''.join(map(lambda x: x[7] if x[4] == int(who) else '', txt_messages)) # 1“我”说的话,0“Ta”说的话
|
||||
|
||||
total_msg_len = len(text)
|
||||
# 使用jieba进行分词,并加入停用词
|
||||
@ -60,15 +61,7 @@ def wordcloud(wxid, is_Annual_report=False, year='2023', who='1'):
|
||||
keyword, max_num = text_data[0]
|
||||
w = (
|
||||
WordCloud(init_opts=opts.InitOpts(width=f"{wordcloud_width}px", height=f"{wordcloud_height}px"))
|
||||
.add(series_name="聊天文字", data_pair=text_data, word_size_range=[20, 100])
|
||||
.set_global_opts(
|
||||
title_opts=opts.TitleOpts(
|
||||
title=f"词云图", subtitle=f"总计{total_msg_len}字",
|
||||
title_textstyle_opts=opts.TextStyleOpts(font_size=23)
|
||||
),
|
||||
tooltip_opts=opts.TooltipOpts(is_show=True),
|
||||
legend_opts=opts.LegendOpts(is_show=False)
|
||||
)
|
||||
.add(series_name="聊天文字", data_pair=text_data, word_size_range=[5, 40])
|
||||
)
|
||||
# return w.render_embed()
|
||||
return {
|
||||
@ -134,20 +127,20 @@ def month_count(wxid, is_Annual_report=False, year='2023'):
|
||||
.add_yaxis("消息数量", y_data,
|
||||
label_opts=opts.LabelOpts(is_show=False),
|
||||
itemstyle_opts=opts.ItemStyleOpts(color="skyblue"),
|
||||
)
|
||||
)
|
||||
.set_global_opts(
|
||||
title_opts=opts.TitleOpts(title="逐月统计", subtitle=None),
|
||||
datazoom_opts=opts.DataZoomOpts(),
|
||||
toolbox_opts=opts.ToolboxOpts(),
|
||||
visualmap_opts=opts.VisualMapOpts(
|
||||
min_=min(y_data),
|
||||
max_=max(y_data),
|
||||
min_=min(y_data),
|
||||
max_=max(y_data),
|
||||
dimension=1, # 根据第2个维度(y 轴)进行映射
|
||||
is_piecewise=False, # 是否分段显示
|
||||
range_color=["#66ccff", "#003366"], # 设置颜色范围
|
||||
type_="color",
|
||||
pos_right="0%",
|
||||
),
|
||||
),
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -1,9 +1,21 @@
|
||||
version = '0.2.8'
|
||||
version = '0.2.9'
|
||||
contact = '701805520'
|
||||
github = 'https://github.com/LC044/WeChatMsg'
|
||||
website = 'http://memotrace.lc044.love/'
|
||||
copyright = '©2023-2023 ShuaikangZhou'
|
||||
description = [
|
||||
'1. 支持获取个人信息<br>',
|
||||
'2. 支持显示聊天界面<br>',
|
||||
'3. 支持导出聊天记录<br> * csv<br> * html<br> * txt<br>',
|
||||
'3. 支持导出聊天记录<br> * csv<br> * html<br> * '
|
||||
'txt<br>',
|
||||
'4. 查找联系人<br>',
|
||||
'5. 生成年度报告<br>',
|
||||
]
|
||||
about = f'''
|
||||
版本:{version}<br>
|
||||
QQ交流群:{contact},加群要求请阅读文档<br>
|
||||
地址:<a href='{github}'>{github}</a><br>
|
||||
官网:<a href='{website}'>{website}</a><br>
|
||||
新特性:<br>{''.join(['' + i for i in description])}<br>
|
||||
Copyright {copyright}
|
||||
'''
|
||||
|
@ -53,6 +53,7 @@ class ContactPC:
|
||||
self.smallHeadImgBLOG = b''
|
||||
self.avatar = QPixmap()
|
||||
self.avatar_path = Icon.Default_avatar_path
|
||||
self.is_chatroom = self.wxid.__contains__('@chatroom')
|
||||
|
||||
def set_avatar(self, img_bytes):
|
||||
if not img_bytes:
|
||||
|
@ -225,10 +225,7 @@ class MainWinController(QMainWindow, mainwindow.Ui_MainWindow):
|
||||
"""
|
||||
关于
|
||||
"""
|
||||
QMessageBox.about(self, "关于",
|
||||
f'''版本:{config.version}<br>QQ交流群:{config.contact},加群要求请阅读文档<br>地址:<a href='https://github.com/LC044/WeChatMsg'>https://github.com/LC044/WeChatMsg</a><br>新特性:<br>{''.join(['' + i for i in config.description])}
|
||||
'''
|
||||
)
|
||||
QMessageBox.about(self, "关于",config.about)
|
||||
|
||||
def decrypt_success(self):
|
||||
QMessageBox.about(self, "解密成功", "请重新启动")
|
||||
|
Loading…
Reference in New Issue
Block a user