消息发送修改

This commit is contained in:
2025-12-04 22:23:40 +08:00
parent 3f7703cda7
commit 214ad239c0

View File

@@ -245,13 +245,19 @@ public class NotificationManagementServiceImpl extends ServiceImpl<NotificationM
String toUser = String.join("|", batch);
// 如果内容包含超链接标签,转换为 Markdown
String md = convertHtmlLinkToMarkdown(content);
if (md != null) {
weChatUtil.sendMarkdownMessage(toUser, md);
} else {
// 如果没有标签但包含 http 链接,直接发送文本也可点击
weChatUtil.sendTextMessage(toUser, content);
try {
if (md != null) {
weChatUtil.sendMarkdownMessage(toUser, md);
} else {
// 如果没有标签但包含 http 链接,直接发送文本也可点击
weChatUtil.sendTextMessage(toUser, content);
}
} catch (Exception e) {
// 记录错误但不抛出异常,避免影响其他批次或后续流程
System.err.println("批量发送企业微信消息失败 (batch " + i + "): " + e.getMessage());
e.printStackTrace();
}
}
}