mirror of
https://github.com/LC044/WeChatMsg
synced 2025-02-23 03:22:17 +08:00
修复年度分析报告第二页溢出的问题#69
This commit is contained in:
parent
b3745867c6
commit
b6f041b67a
@ -126,19 +126,19 @@ class Msg:
|
|||||||
lock.release()
|
lock.release()
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def get_messages_by_keyword(self, username_, keyword, num=5):
|
def get_messages_by_keyword(self, username_, keyword, num=5, max_len=10):
|
||||||
if not self.open_flag:
|
if not self.open_flag:
|
||||||
return None
|
return None
|
||||||
sql = '''
|
sql = '''
|
||||||
select localId,TalkerId,Type,SubType,IsSender,CreateTime,Status,StrContent,strftime('%Y-%m-%d %H:%M:%S',CreateTime,'unixepoch','localtime') as StrTime,MsgSvrID
|
select localId,TalkerId,Type,SubType,IsSender,CreateTime,Status,StrContent,strftime('%Y-%m-%d %H:%M:%S',CreateTime,'unixepoch','localtime') as StrTime,MsgSvrID
|
||||||
from MSG
|
from MSG
|
||||||
where StrTalker=? and Type=1 and StrContent like ?
|
where StrTalker=? and Type=1 and LENGTH(StrContent)<? and StrContent like ?
|
||||||
order by CreateTime desc
|
order by CreateTime desc
|
||||||
'''
|
'''
|
||||||
temp = []
|
temp = []
|
||||||
try:
|
try:
|
||||||
lock.acquire(True)
|
lock.acquire(True)
|
||||||
self.cursor.execute(sql, [username_, f'%{keyword}%'])
|
self.cursor.execute(sql, [username_, max_len, f'%{keyword}%'])
|
||||||
messages = self.cursor.fetchall()
|
messages = self.cursor.fetchall()
|
||||||
finally:
|
finally:
|
||||||
lock.release()
|
lock.release()
|
||||||
|
@ -26,7 +26,7 @@ def wordcloud(wxid):
|
|||||||
# 统计词频
|
# 统计词频
|
||||||
word_count = Counter(words)
|
word_count = Counter(words)
|
||||||
# 过滤停用词
|
# 过滤停用词
|
||||||
stopwords_file = './app/data/stopwords.txt'
|
stopwords_file = './app000/data/stopwords.txt'
|
||||||
try:
|
try:
|
||||||
with open(stopwords_file, "r", encoding="utf-8") as stopword_file:
|
with open(stopwords_file, "r", encoding="utf-8") as stopword_file:
|
||||||
stopwords = set(stopword_file.read().splitlines())
|
stopwords = set(stopword_file.read().splitlines())
|
||||||
@ -65,7 +65,7 @@ def wordcloud(wxid):
|
|||||||
'chart_data': w.dump_options_with_quotes(),
|
'chart_data': w.dump_options_with_quotes(),
|
||||||
'keyword': keyword,
|
'keyword': keyword,
|
||||||
'max_num': str(max_num),
|
'max_num': str(max_num),
|
||||||
'dialogs': msg_db.get_messages_by_keyword(wxid, keyword, num=5)
|
'dialogs': msg_db.get_messages_by_keyword(wxid, keyword, num=5, max_len=12)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -16,6 +16,7 @@ wxid
|
|||||||
裂开
|
裂开
|
||||||
苦涩
|
苦涩
|
||||||
叹气
|
叹气
|
||||||
|
凋谢
|
||||||
让我看看
|
让我看看
|
||||||
酷
|
酷
|
||||||
奋斗
|
奋斗
|
||||||
|
@ -42,16 +42,16 @@ def index0():
|
|||||||
@app.route('/home')
|
@app.route('/home')
|
||||||
def home():
|
def home():
|
||||||
try:
|
try:
|
||||||
|
first_message, first_time = msg_db.get_first_time_of_message(contact.wxid)
|
||||||
|
except IndexError:
|
||||||
|
return set_text('咱就是说,一次都没聊过就别分析了')
|
||||||
data = {
|
data = {
|
||||||
'sub_title': '二零二三年度报告',
|
'sub_title': '二零二三年度报告',
|
||||||
'avatar_path': contact.avatar_path,
|
'avatar_path': contact.avatar_path,
|
||||||
'nickname': contact.remark,
|
'nickname': contact.remark,
|
||||||
'first_time': msg_db.get_first_time_of_message(contact.wxid)[1],
|
'first_time': first_time,
|
||||||
}
|
}
|
||||||
return render_template('home.html', **data)
|
return render_template('home.html', **data)
|
||||||
except IndexError:
|
|
||||||
return set_text('咱就是说,一次都没聊过就别分析了')
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@app.route('/wordcloud')
|
@app.route('/wordcloud')
|
||||||
|
@ -295,7 +295,7 @@ python main.py
|
|||||||
---
|
---
|
||||||
|
|
||||||
> 声明:该项目有且仅有一个目的:“留痕”——我的数据我做主,前提是“我的数据”其次才是“我做主”,禁止任何人以任何形式将其用于任何非法用途,对于使用该程序所造成的任何后果,所有创作者不承担任何责任🙄<br>
|
> 声明:该项目有且仅有一个目的:“留痕”——我的数据我做主,前提是“我的数据”其次才是“我做主”,禁止任何人以任何形式将其用于任何非法用途,对于使用该程序所造成的任何后果,所有创作者不承担任何责任🙄<br>
|
||||||
> 该软件不会对您使用的微信造成任何影响,更不会对他人的微信造成任何影响,任何企图篡改微信聊天数据的想法都是无稽之谈。本项目所有功能均建立在”前言“的基础之上,基于该项目的所有开发者均不能接受任何有悖于”前言“的功能需求,违者后果自负。
|
> 该软件不会对您使用的微信造成任何影响,更不会对他人的微信造成任何影响,不能找回删除的聊天记录,任何企图篡改微信聊天数据的想法都是无稽之谈。本项目所有功能均建立在”前言“的基础之上,基于该项目的所有开发者均不能接受任何有悖于”前言“的功能需求,违者后果自负。
|
||||||
|
|
||||||
[](https://star-history.com/?utm_source=bestxtools.com#LC044/WeChatMsg&Date)
|
[](https://star-history.com/?utm_source=bestxtools.com#LC044/WeChatMsg&Date)
|
||||||
|
|
||||||
|
@ -12,4 +12,6 @@ requests
|
|||||||
flask==3.0.0
|
flask==3.0.0
|
||||||
pyecharts==2.0.1
|
pyecharts==2.0.1
|
||||||
jieba==0.42.1
|
jieba==0.42.1
|
||||||
|
google==3.0.0
|
||||||
protobuf==4.25.1
|
protobuf==4.25.1
|
||||||
|
soupsieve==2.5
|
||||||
|
Loading…
Reference in New Issue
Block a user