mirror of
https://github.com/LC044/WeChatMsg
synced 2025-02-22 19:02:17 +08:00
增加日志模块
This commit is contained in:
parent
5ccf2292e1
commit
7b50f47332
1
.gitignore
vendored
1
.gitignore
vendored
@ -11,4 +11,5 @@ app/data/image2
|
|||||||
app/data/emoji
|
app/data/emoji
|
||||||
*.db
|
*.db
|
||||||
*.pyc
|
*.pyc
|
||||||
|
*.log
|
||||||
test*
|
test*
|
@ -4,9 +4,15 @@
|
|||||||
<option name="autoReloadType" value="SELECTIVE" />
|
<option name="autoReloadType" value="SELECTIVE" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="84e65474-7da9-466d-baf3-cc88dde3ffdd" name="变更" comment="main首次加载解密界面">
|
<list default="true" id="84e65474-7da9-466d-baf3-cc88dde3ffdd" name="变更" comment="update readme">
|
||||||
<change afterPath="$PROJECT_DIR$/doc/数据库介绍.md" afterDir="false" />
|
<change afterPath="$PROJECT_DIR$/app/log/__init__.py" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/readme.md" beforeDir="false" afterPath="$PROJECT_DIR$/readme.md" afterDir="false" />
|
<change afterPath="$PROJECT_DIR$/app/log/logger.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/.gitignore" beforeDir="false" afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/app/Ui/chat/chat.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/chat/chat.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/app/Ui/contact/analysis/analysis.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/contact/analysis/analysis.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/app/Ui/contact/analysis/charts.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/Ui/contact/analysis/charts.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/doc/获取个人文件/使用说明.md" beforeDir="false" afterPath="$PROJECT_DIR$/doc/获取个人文件/使用说明.md" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@ -72,7 +78,7 @@
|
|||||||
<recent name="D:\Project\PythonProject\WeChatMsg\app\Ui" />
|
<recent name="D:\Project\PythonProject\WeChatMsg\app\Ui" />
|
||||||
</key>
|
</key>
|
||||||
</component>
|
</component>
|
||||||
<component name="RunManager" selected="Python.decrypt_window">
|
<component name="RunManager" selected="Python.main">
|
||||||
<configuration name="decrypt" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
|
<configuration name="decrypt" type="PythonConfigurationType" factoryName="Python" temporary="true" nameIsGenerated="true">
|
||||||
<module name="WeChatMsg" />
|
<module name="WeChatMsg" />
|
||||||
<option name="INTERPRETER_OPTIONS" value="" />
|
<option name="INTERPRETER_OPTIONS" value="" />
|
||||||
@ -201,11 +207,11 @@
|
|||||||
</configuration>
|
</configuration>
|
||||||
<recent_temporary>
|
<recent_temporary>
|
||||||
<list>
|
<list>
|
||||||
|
<item itemvalue="Python.main" />
|
||||||
<item itemvalue="Python.decrypt_window" />
|
<item itemvalue="Python.decrypt_window" />
|
||||||
<item itemvalue="Python.decrypt" />
|
<item itemvalue="Python.decrypt" />
|
||||||
<item itemvalue="Python.get_wx_info" />
|
<item itemvalue="Python.get_wx_info" />
|
||||||
<item itemvalue="Python.micro_msg (1)" />
|
<item itemvalue="Python.micro_msg (1)" />
|
||||||
<item itemvalue="Python.main" />
|
|
||||||
</list>
|
</list>
|
||||||
</recent_temporary>
|
</recent_temporary>
|
||||||
</component>
|
</component>
|
||||||
@ -221,13 +227,6 @@
|
|||||||
<option name="presentableId" value="Default" />
|
<option name="presentableId" value="Default" />
|
||||||
<updated>1672848140146</updated>
|
<updated>1672848140146</updated>
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00004" summary="update1">
|
|
||||||
<created>1673413541210</created>
|
|
||||||
<option name="number" value="00004" />
|
|
||||||
<option name="presentableId" value="LOCAL-00004" />
|
|
||||||
<option name="project" value="LOCAL" />
|
|
||||||
<updated>1673413541210</updated>
|
|
||||||
</task>
|
|
||||||
<task id="LOCAL-00005" summary="update1">
|
<task id="LOCAL-00005" summary="update1">
|
||||||
<created>1674280781244</created>
|
<created>1674280781244</created>
|
||||||
<option name="number" value="00005" />
|
<option name="number" value="00005" />
|
||||||
@ -564,7 +563,14 @@
|
|||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1699797493106</updated>
|
<updated>1699797493106</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="53" />
|
<task id="LOCAL-00053" summary="update readme">
|
||||||
|
<created>1699797862964</created>
|
||||||
|
<option name="number" value="00053" />
|
||||||
|
<option name="presentableId" value="LOCAL-00053" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1699797862964</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="54" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="UnknownFeatures">
|
<component name="UnknownFeatures">
|
||||||
@ -614,7 +620,6 @@
|
|||||||
<MESSAGE value="修复部分bug" />
|
<MESSAGE value="修复部分bug" />
|
||||||
<MESSAGE value="替换chat里的contact" />
|
<MESSAGE value="替换chat里的contact" />
|
||||||
<MESSAGE value="增加中文路径提示" />
|
<MESSAGE value="增加中文路径提示" />
|
||||||
<MESSAGE value="update readme" />
|
|
||||||
<MESSAGE value="用stackWidget重写contactUI" />
|
<MESSAGE value="用stackWidget重写contactUI" />
|
||||||
<MESSAGE value="修改联系人视图架构" />
|
<MESSAGE value="修改联系人视图架构" />
|
||||||
<MESSAGE value="加快打开速度" />
|
<MESSAGE value="加快打开速度" />
|
||||||
@ -625,7 +630,8 @@
|
|||||||
<MESSAGE value="增加导航按钮效果" />
|
<MESSAGE value="增加导航按钮效果" />
|
||||||
<MESSAGE value="新增PC数据库解密" />
|
<MESSAGE value="新增PC数据库解密" />
|
||||||
<MESSAGE value="main首次加载解密界面" />
|
<MESSAGE value="main首次加载解密界面" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="main首次加载解密界面" />
|
<MESSAGE value="update readme" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value="update readme" />
|
||||||
<option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="true" />
|
<option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="true" />
|
||||||
<option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="true" />
|
<option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="true" />
|
||||||
</component>
|
</component>
|
||||||
|
@ -14,6 +14,7 @@ from docxcompose.composer import Composer
|
|||||||
|
|
||||||
from app import person
|
from app import person
|
||||||
from app.DataBase import data
|
from app.DataBase import data
|
||||||
|
from app.log import log
|
||||||
|
|
||||||
|
|
||||||
# import data
|
# import data
|
||||||
@ -64,6 +65,7 @@ class Output(QThread):
|
|||||||
self.output_type = type_
|
self.output_type = type_
|
||||||
self.total_num = 0
|
self.total_num = 0
|
||||||
|
|
||||||
|
@log
|
||||||
def merge_docx(self, conRemark, n):
|
def merge_docx(self, conRemark, n):
|
||||||
origin_docx_path = f"{os.path.abspath('.')}/data/聊天记录/{conRemark}"
|
origin_docx_path = f"{os.path.abspath('.')}/data/聊天记录/{conRemark}"
|
||||||
all_file_path = []
|
all_file_path = []
|
||||||
@ -98,6 +100,7 @@ class Output(QThread):
|
|||||||
self.okSignal.emit(1)
|
self.okSignal.emit(1)
|
||||||
self.progressSignal.emit(self.i)
|
self.progressSignal.emit(self.i)
|
||||||
|
|
||||||
|
@log
|
||||||
def to_csv(self, conRemark, path):
|
def to_csv(self, conRemark, path):
|
||||||
origin_docx_path = f"{os.path.abspath('.')}/data/聊天记录/{conRemark}"
|
origin_docx_path = f"{os.path.abspath('.')}/data/聊天记录/{conRemark}"
|
||||||
messages = data.get_all_message(self.ta_username)
|
messages = data.get_all_message(self.ta_username)
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
@comment : 聊天窗口
|
@comment : 聊天窗口
|
||||||
"""
|
"""
|
||||||
import time
|
import time
|
||||||
|
import traceback
|
||||||
from typing import Dict
|
from typing import Dict
|
||||||
|
|
||||||
import xmltodict
|
import xmltodict
|
||||||
@ -17,6 +18,7 @@ from PyQt5.QtGui import *
|
|||||||
from PyQt5.QtWidgets import *
|
from PyQt5.QtWidgets import *
|
||||||
|
|
||||||
from app.Ui.MyComponents.Button_Contact import ContactUi
|
from app.Ui.MyComponents.Button_Contact import ContactUi
|
||||||
|
from app.log import logger, log
|
||||||
from .chatUi import *
|
from .chatUi import *
|
||||||
from ...DataBase import data
|
from ...DataBase import data
|
||||||
from ...ImageBox.ui import MainDemo
|
from ...ImageBox.ui import MainDemo
|
||||||
@ -68,28 +70,6 @@ class ChatController(QWidget, Ui_Form):
|
|||||||
self.message.setOpenExternalLinks(False)
|
self.message.setOpenExternalLinks(False)
|
||||||
# self.message.anchorClicked(self.hyperlink())
|
# self.message.anchorClicked(self.hyperlink())
|
||||||
self.message.anchorClicked.connect(self.hyperlink)
|
self.message.anchorClicked.connect(self.hyperlink)
|
||||||
# self.btn_sendMsg = QtWidgets.QPushButton(self.textEdit)
|
|
||||||
# self.btn_sendMsg.setGeometry(QtCore.QRect(1, 1, 121, 51))
|
|
||||||
# font = QtGui.QFont()
|
|
||||||
# font.setFamily("黑体")
|
|
||||||
# font.setPointSize(15)
|
|
||||||
# font.setBold(False)
|
|
||||||
# font.setWeight(50)
|
|
||||||
# self.btn_sendMsg.setFont(font)
|
|
||||||
# self.btn_sendMsg.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
|
|
||||||
# self.btn_sendMsg.setMouseTracking(False)
|
|
||||||
# self.btn_sendMsg.setAutoFillBackground(False)
|
|
||||||
# self.btn_sendMsg.setStyleSheet("QPushButton {background-color: #f0f0f0;\n"
|
|
||||||
# "padding: 10px;\n"
|
|
||||||
# "color:rgb(5,180,104);}\n"
|
|
||||||
# "QPushButton:hover{background-color: rgb(198,198,198)}\n"
|
|
||||||
# )
|
|
||||||
# self.btn_sendMsg.setIconSize(QtCore.QSize(40, 40))
|
|
||||||
# self.btn_sendMsg.setCheckable(False)
|
|
||||||
# self.btn_sendMsg.setAutoDefault(True)
|
|
||||||
# self.btn_sendMsg.setObjectName("btn_sendMsg")
|
|
||||||
# _translate = QtCore.QCoreApplication.translate
|
|
||||||
# self.btn_sendMsg.setText(_translate("Dialog", "发送"))
|
|
||||||
self.btn_sendMsg_2.setToolTip('按Enter键发送,按Ctrl+Enter键换行')
|
self.btn_sendMsg_2.setToolTip('按Enter键发送,按Ctrl+Enter键换行')
|
||||||
|
|
||||||
def showChat(self):
|
def showChat(self):
|
||||||
@ -204,6 +184,7 @@ class ChatController(QWidget, Ui_Form):
|
|||||||
self.last_msg_time = msg_time
|
self.last_msg_time = msg_time
|
||||||
self.message.insertHtml(html)
|
self.message.insertHtml(html)
|
||||||
|
|
||||||
|
@log
|
||||||
def showMsg(self, message):
|
def showMsg(self, message):
|
||||||
"""
|
"""
|
||||||
显示聊天消息
|
显示聊天消息
|
||||||
@ -236,6 +217,7 @@ class ChatController(QWidget, Ui_Form):
|
|||||||
self.pat_a_pat(content)
|
self.pat_a_pat(content)
|
||||||
# self.message.moveCursor(self.message.textCursor().End)
|
# self.message.moveCursor(self.message.textCursor().End)
|
||||||
|
|
||||||
|
@log
|
||||||
def pat_a_pat(self, content):
|
def pat_a_pat(self, content):
|
||||||
try:
|
try:
|
||||||
pat_data = xmltodict.parse(content)
|
pat_data = xmltodict.parse(content)
|
||||||
@ -262,6 +244,7 @@ class ChatController(QWidget, Ui_Form):
|
|||||||
</table>''' % template
|
</table>''' % template
|
||||||
self.message.insertHtml(html)
|
self.message.insertHtml(html)
|
||||||
|
|
||||||
|
@log
|
||||||
def show_recall_information(self, content):
|
def show_recall_information(self, content):
|
||||||
html = '''
|
html = '''
|
||||||
<table align="center" style="vertical-align: middle;">
|
<table align="center" style="vertical-align: middle;">
|
||||||
@ -273,14 +256,15 @@ class ChatController(QWidget, Ui_Form):
|
|||||||
</table>''' % content
|
</table>''' % content
|
||||||
self.message.insertHtml(html)
|
self.message.insertHtml(html)
|
||||||
|
|
||||||
|
@log
|
||||||
def show_emoji(self, isSend, imagePath, content):
|
def show_emoji(self, isSend, imagePath, content):
|
||||||
imgPath = data.get_emoji(imagePath)
|
imgPath = data.get_emoji(imagePath)
|
||||||
print('emoji:', imgPath)
|
|
||||||
if not imgPath:
|
if not imgPath:
|
||||||
return False
|
return False
|
||||||
try:
|
try:
|
||||||
image = Image.open(imgPath)
|
image = Image.open(imgPath)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
logger.error(f"\nshow_emoji is error,here are details:\n{traceback.format_exc()}")
|
||||||
print(e)
|
print(e)
|
||||||
return
|
return
|
||||||
imagePixmap = image.size # 宽高像素
|
imagePixmap = image.size # 宽高像素
|
||||||
@ -303,6 +287,7 @@ class ChatController(QWidget, Ui_Form):
|
|||||||
self.chatroom_left(html, username=username, style=style)
|
self.chatroom_left(html, username=username, style=style)
|
||||||
self.left(html, style=style)
|
self.left(html, style=style)
|
||||||
|
|
||||||
|
@log
|
||||||
def show_img(self, isSend, imgPath, content):
|
def show_img(self, isSend, imgPath, content):
|
||||||
'THUMBNAIL_DIRPATH://th_29cd0f0ca87652943be9ede365aabeaa'
|
'THUMBNAIL_DIRPATH://th_29cd0f0ca87652943be9ede365aabeaa'
|
||||||
# imgPath = imgPath.split('th_')[1]
|
# imgPath = imgPath.split('th_')[1]
|
||||||
@ -325,6 +310,7 @@ class ChatController(QWidget, Ui_Form):
|
|||||||
else:
|
else:
|
||||||
self.left(html, style=style)
|
self.left(html, style=style)
|
||||||
|
|
||||||
|
@log
|
||||||
def show_text(self, isSend, content):
|
def show_text(self, isSend, content):
|
||||||
if isSend:
|
if isSend:
|
||||||
html = '''
|
html = '''
|
||||||
|
@ -18,8 +18,6 @@ class AnalysisController(QWidget):
|
|||||||
|
|
||||||
# self.setWindowFlag(Qt.FramelessWindowHint)
|
# self.setWindowFlag(Qt.FramelessWindowHint)
|
||||||
self.setStyleSheet('''QWidget{background-color:rgb(255, 255, 255);}''')
|
self.setStyleSheet('''QWidget{background-color:rgb(255, 255, 255);}''')
|
||||||
# self.setBackground()
|
|
||||||
# self.resize(400, 300)
|
|
||||||
self.center()
|
self.center()
|
||||||
self.setAttribute(Qt.WA_AttributeCount)
|
self.setAttribute(Qt.WA_AttributeCount)
|
||||||
self.label_01()
|
self.label_01()
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import os
|
import os
|
||||||
|
import traceback
|
||||||
|
|
||||||
import jieba
|
import jieba
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
@ -6,6 +7,7 @@ import xmltodict
|
|||||||
from pyecharts import options as opts
|
from pyecharts import options as opts
|
||||||
from pyecharts.charts import Pie, WordCloud, Calendar, Bar, Line, Timeline, Grid
|
from pyecharts.charts import Pie, WordCloud, Calendar, Bar, Line, Timeline, Grid
|
||||||
|
|
||||||
|
from app.log import logger, log
|
||||||
from ....DataBase import data
|
from ....DataBase import data
|
||||||
|
|
||||||
# from app.DataBase import data
|
# from app.DataBase import data
|
||||||
@ -38,6 +40,7 @@ wordcloud_width = 780
|
|||||||
wordcloud_height = 720
|
wordcloud_height = 720
|
||||||
|
|
||||||
|
|
||||||
|
@log
|
||||||
def send_recv_rate(username):
|
def send_recv_rate(username):
|
||||||
send_num = data.send_nums(username)
|
send_num = data.send_nums(username)
|
||||||
recv_num = data.recv_nums(username)
|
recv_num = data.recv_nums(username)
|
||||||
@ -67,6 +70,7 @@ def send_recv_rate(username):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@log
|
||||||
def msg_type_rate(username):
|
def msg_type_rate(username):
|
||||||
type_data = data.msg_type_num(username)
|
type_data = data.msg_type_num(username)
|
||||||
type_data = sorted(type_data, key=lambda x: x[1], reverse=True)
|
type_data = sorted(type_data, key=lambda x: x[1], reverse=True)
|
||||||
@ -100,6 +104,7 @@ def msg_type_rate(username):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@log
|
||||||
def message_word_cloud(username):
|
def message_word_cloud(username):
|
||||||
text = data.get_text(username)
|
text = data.get_text(username)
|
||||||
total_msg_len = len(text)
|
total_msg_len = len(text)
|
||||||
@ -132,6 +137,7 @@ def message_word_cloud(username):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@log
|
||||||
def calendar_chart(username):
|
def calendar_chart(username):
|
||||||
msg_data = data.get_msg_by_days(username, year='2022')
|
msg_data = data.get_msg_by_days(username, year='2022')
|
||||||
if not msg_data:
|
if not msg_data:
|
||||||
@ -162,6 +168,7 @@ def calendar_chart(username):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@log
|
||||||
def month_num(username):
|
def month_num(username):
|
||||||
"""
|
"""
|
||||||
每月聊天条数
|
每月聊天条数
|
||||||
@ -182,6 +189,7 @@ def month_num(username):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@log
|
||||||
def chat_session(username):
|
def chat_session(username):
|
||||||
msg_data = data.get_msg_by_hour(username)
|
msg_data = data.get_msg_by_hour(username)
|
||||||
x_axis = list(map(lambda x: x[0], msg_data))
|
x_axis = list(map(lambda x: x[0], msg_data))
|
||||||
@ -219,6 +227,7 @@ def chat_session(username):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@log
|
||||||
def sport(username):
|
def sport(username):
|
||||||
sports = data.get_sport()
|
sports = data.get_sport()
|
||||||
ranks = []
|
ranks = []
|
||||||
@ -230,8 +239,8 @@ def sport(username):
|
|||||||
rank_data = xmltodict.parse(content)
|
rank_data = xmltodict.parse(content)
|
||||||
sub_data = rank_data['msg']['appmsg']['hardwareinfo']['messagenodeinfo']
|
sub_data = rank_data['msg']['appmsg']['hardwareinfo']['messagenodeinfo']
|
||||||
# print(sub_data)
|
# print(sub_data)
|
||||||
my_rank = sub_data['rankinfo']['rank']['rankdisplay']
|
# my_rank = sub_data['rankinfo']['rank']['rankdisplay']
|
||||||
my_steps = int(sub_data['rankinfo']['score']['scoredisplay'])
|
# my_steps = int(sub_data['rankinfo']['score']['scoredisplay'])
|
||||||
# print(f'rank: {my_rank},steps: {my_steps}')
|
# print(f'rank: {my_rank},steps: {my_steps}')
|
||||||
rank_view = rank_data['msg']['appmsg']['hardwareinfo']['rankview']['rankinfolist']['rankinfo']
|
rank_view = rank_data['msg']['appmsg']['hardwareinfo']['rankview']['rankinfolist']['rankinfo']
|
||||||
for userinfo in rank_view:
|
for userinfo in rank_view:
|
||||||
@ -243,6 +252,7 @@ def sport(username):
|
|||||||
steps.append(steps_ta)
|
steps.append(steps_ta)
|
||||||
date.append(t)
|
date.append(t)
|
||||||
except:
|
except:
|
||||||
|
logger.error(f"\nsport is error,here are details:\n{traceback.format_exc()}\n")
|
||||||
continue
|
continue
|
||||||
try:
|
try:
|
||||||
# todo 可能没有运动信息
|
# todo 可能没有运动信息
|
||||||
@ -349,6 +359,7 @@ def sport(username):
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@log
|
||||||
def chat_start_endTime(username):
|
def chat_start_endTime(username):
|
||||||
start_time = data.get_msg_start_time(username)
|
start_time = data.get_msg_start_time(username)
|
||||||
end_time = data.get_msg_end_time(username)
|
end_time = data.get_msg_end_time(username)
|
||||||
@ -431,11 +442,11 @@ setInterval(getRTime, 1000);
|
|||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
''' % (year, month + '-' + day, hour, minute, second, start_time)
|
''' % (year, month + '-' + day, hour, minute, second, start_time)
|
||||||
print(year, month, day, hour, minute, second)
|
|
||||||
with open('./data/聊天统计/time.html', 'w', encoding='utf-8') as f:
|
with open('./data/聊天统计/time.html', 'w', encoding='utf-8') as f:
|
||||||
f.write(html)
|
f.write(html)
|
||||||
|
|
||||||
|
|
||||||
|
@log
|
||||||
def title(username):
|
def title(username):
|
||||||
conRemark = data.get_conRemark(username)
|
conRemark = data.get_conRemark(username)
|
||||||
avatar = data.get_avator(username)
|
avatar = data.get_avator(username)
|
||||||
@ -519,7 +530,6 @@ font-size: 18px;
|
|||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
''' % (avatar, conRemark)
|
''' % (avatar, conRemark)
|
||||||
print('头像地址', avatar)
|
|
||||||
with open('./data/聊天统计/title.html', 'w', encoding='utf-8') as f:
|
with open('./data/聊天统计/title.html', 'w', encoding='utf-8') as f:
|
||||||
f.write(html)
|
f.write(html)
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ import pandas as pd
|
|||||||
from pyecharts import options as opts
|
from pyecharts import options as opts
|
||||||
from pyecharts.charts import Line
|
from pyecharts.charts import Line
|
||||||
|
|
||||||
|
from app.log import log
|
||||||
from ....DataBase import data
|
from ....DataBase import data
|
||||||
|
|
||||||
|
|
||||||
@ -18,6 +19,7 @@ def load_data(wxid):
|
|||||||
import snownlp
|
import snownlp
|
||||||
|
|
||||||
|
|
||||||
|
@log
|
||||||
def emotion_analysis(wxid):
|
def emotion_analysis(wxid):
|
||||||
dates = []
|
dates = []
|
||||||
emotions = []
|
emotions = []
|
||||||
@ -33,6 +35,7 @@ def emotion_analysis(wxid):
|
|||||||
return dates, emotions
|
return dates, emotions
|
||||||
|
|
||||||
|
|
||||||
|
@log
|
||||||
def plot_emotion(wxid):
|
def plot_emotion(wxid):
|
||||||
"""
|
"""
|
||||||
画图
|
画图
|
||||||
|
3
app/log/__init__.py
Normal file
3
app/log/__init__.py
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
from .logger import log, logger
|
||||||
|
|
||||||
|
__all__ = ["logger", "log"]
|
33
app/log/logger.py
Normal file
33
app/log/logger.py
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
import logging
|
||||||
|
import os
|
||||||
|
import time
|
||||||
|
import traceback
|
||||||
|
from functools import wraps
|
||||||
|
|
||||||
|
filename = time.strftime("%Y-%m-%d", time.localtime(time.time()))
|
||||||
|
if not os.path.exists('./app/log/logs'):
|
||||||
|
os.mkdir('./app/log/logs')
|
||||||
|
logger = logging.getLogger('test')
|
||||||
|
logger.setLevel(level=logging.DEBUG)
|
||||||
|
formatter = logging.Formatter('%(asctime)s - %(filename)s[line:%(lineno)d] - %(levelname)s: %(message)s')
|
||||||
|
file_handler = logging.FileHandler(f'./app/log/logs/{filename}-log.log')
|
||||||
|
file_handler.setLevel(level=logging.INFO)
|
||||||
|
file_handler.setFormatter(formatter)
|
||||||
|
|
||||||
|
stream_handler = logging.StreamHandler()
|
||||||
|
stream_handler.setLevel(logging.DEBUG)
|
||||||
|
stream_handler.setFormatter(formatter)
|
||||||
|
|
||||||
|
logger.addHandler(file_handler)
|
||||||
|
logger.addHandler(stream_handler)
|
||||||
|
|
||||||
|
|
||||||
|
def log(func):
|
||||||
|
@wraps(func)
|
||||||
|
def log_(*args, **kwargs):
|
||||||
|
try:
|
||||||
|
return func(*args, **kwargs)
|
||||||
|
except Exception as e:
|
||||||
|
logger.error(f"\n{func.__qualname__} is error,here are details:\n{traceback.format_exc()}")
|
||||||
|
|
||||||
|
return log_
|
@ -3,16 +3,14 @@
|
|||||||
|
|
||||||
对于模拟器中信息提取,如果使用自带的Amaze复制到共享文件夹出现错误,无法导入可以使用MT管理器
|
对于模拟器中信息提取,如果使用自带的Amaze复制到共享文件夹出现错误,无法导入可以使用MT管理器
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
MT管理器打开界面如下图所示,右边打开微信文件存储位置,找到MicroMsg,左边打开共享文件位置,可以通过右边的电脑图案查看路径。
|
MT管理器打开界面如下图所示,右边打开微信文件存储位置,找到MicroMsg,左边打开共享文件位置,可以通过右边的电脑图案查看路径。
|
||||||
|
|
||||||
如图,长按MicroMsg文件夹,弹出弹窗,点击复制->确认。
|
如图,长按MicroMsg文件夹,弹出弹窗,点击复制->确认。
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
开始复制,稍等一会即可完成复制。
|
开始复制,稍等一会即可完成复制。
|
||||||
|
|
||||||

|

|
||||||
|
Loading…
Reference in New Issue
Block a user