From 2b8bbce1774769842d4b4660a4e99c9c833d5797 Mon Sep 17 00:00:00 2001 From: Yucheng Huo Date: Mon, 22 Apr 2024 03:33:03 -0400 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=B9=B4=E5=BA=A6=E6=8A=A5?= =?UTF-8?q?=E5=91=8A=EF=BC=8C=E5=A2=9E=E5=8A=A0=E5=BE=AE=E4=BF=A1=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E8=A1=A8=E6=83=85=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/web_ui/templates/christmas.html | 11 +++++++++-- app/web_ui/web.py | 5 +++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/app/web_ui/templates/christmas.html b/app/web_ui/templates/christmas.html index d03bbe0..4d47815 100644 --- a/app/web_ui/templates/christmas.html +++ b/app/web_ui/templates/christmas.html @@ -5,6 +5,13 @@ 微信年度聊天报告 + @@ -143,14 +150,14 @@
- {{dialog[1]}} + {{dialog[1] | safe}}
{% endif %} {% if dialog[0]==1: %}
- {{dialog[1]}} + {{dialog[1] | safe}}
diff --git a/app/web_ui/web.py b/app/web_ui/web.py index ec98616..832f738 100644 --- a/app/web_ui/web.py +++ b/app/web_ui/web.py @@ -14,6 +14,7 @@ from app.config import SERVER_API_URL from app.person import Contact, Me, ContactDefault from app.util.emoji import get_most_emoji from app.util.region_conversion import conversion_region_to_chinese +from app.util.replace_text import replace_text app = Flask(__name__) @@ -113,6 +114,10 @@ def christmas(wxid): if time_ in item: label = key latest_dialog = msg_db.get_latest_time_of_message(contact.wxid, time_range=time_range) + + for i, dialog in enumerate(latest_dialog): + latest_dialog[i] = (dialog[0], replace_text(dialog[1]), dialog[2], dialog[3]) + latest_time = latest_dialog[0][2] if latest_dialog else '' time_data = { 'latest_time': latest_time,