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