优化:企微通知时间只显示 MM-DD HH:MM,去掉年份和秒
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user