From 6d6b355283f14f4e53fe0bf6ce62ad441118097f Mon Sep 17 00:00:00 2001 From: shuaikangzhou <863909694@qq.com> Date: Tue, 5 Dec 2023 20:39:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BE=9D=E8=B5=96=EF=BC=8C?= =?UTF-8?q?=E5=B9=B4=E5=BA=A6=E6=8A=A5=E5=91=8A=E5=A2=9E=E5=8A=A0=E7=BC=BA?= =?UTF-8?q?=E7=9C=81=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/web_ui/web.py | 60 ++++++++++++++++++++++++++++++++++----------- requirements_pc.txt | 3 +++ 2 files changed, 49 insertions(+), 14 deletions(-) diff --git a/app/web_ui/web.py b/app/web_ui/web.py index ef121c4..0441a5b 100644 --- a/app/web_ui/web.py +++ b/app/web_ui/web.py @@ -41,13 +41,17 @@ def index0(): @app.route('/home') def home(): - data = { - 'sub_title': '二零二三年度报告', - 'avatar_path': contact.avatar_path, - 'nickname': contact.remark, - 'first_time': msg_db.get_first_time_of_message(contact.wxid)[1], - } - return render_template('home.html', **data) + try: + data = { + 'sub_title': '二零二三年度报告', + 'avatar_path': contact.avatar_path, + 'nickname': contact.remark, + 'first_time': msg_db.get_first_time_of_message(contact.wxid)[1], + } + return render_template('home.html', **data) + except IndexError: + return set_text('咱就是说,一次都没聊过就别分析了') + @app.route('/wordcloud') @@ -61,15 +65,43 @@ def one(): return render_template('wordcloud.html', **world_cloud_data) +def set_text(text): + html = ''' + + +
+ + +