From 03082a593444d8f2c046f9b5d4ea064054241ddf Mon Sep 17 00:00:00 2001 From: 16337 <1633794139@qq.com> Date: Thu, 19 Mar 2026 11:13:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=9A=E4=BC=81=E5=BE=AE?= =?UTF-8?q?=E9=80=9A=E7=9F=A5=E6=97=B6=E9=97=B4=E5=8F=AA=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=20MM-DD=20HH:MM=EF=BC=8C=E5=8E=BB=E6=8E=89=E5=B9=B4=E4=BB=BD?= =?UTF-8?q?=E5=92=8C=E7=A7=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/notify_dispatch.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/app/services/notify_dispatch.py b/app/services/notify_dispatch.py index 7e18dea..c06b204 100644 --- a/app/services/notify_dispatch.py +++ b/app/services/notify_dispatch.py @@ -107,10 +107,13 @@ async def process_alarm_notification(alarm_data: Dict): logger.info(f"企微未启用,跳过通知: {alarm_id}") return - event_time_str = ( - event_time.strftime("%Y-%m-%d %H:%M:%S") - if isinstance(event_time, datetime) else str(event_time or "") - ) + # 通知显示时间:只显示 MM-DD HH:MM(不含年份和秒) + if isinstance(event_time, datetime): + event_time_str = event_time.strftime("%m-%d %H:%M") + else: + # 字符串格式 "2026-03-19 10:54:24" → "03-19 10:54" + s = str(event_time or "") + event_time_str = s[5:16] if len(s) >= 16 else s user_ids = [p["wechat_uid"] for p in persons] group_chat_id = settings.wechat.group_chat_id