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 = ''' + + +
+ + +