Commit 3b92042d4b6efc4f61506519d2135c3bb96ad5cc

Authored by 芋道源码
Committed by Gitee
2 parents 02e22c66 e25099a4

!485 发送邮件逻辑优化,邮件标题支持模版参数

Merge pull request !485 from 傲世孤尘/feature/20230519
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/mail/MailSendServiceImpl.java
@@ -89,13 +89,14 @@ public class MailSendServiceImpl implements MailSendService { @@ -89,13 +89,14 @@ public class MailSendServiceImpl implements MailSendService {
89 89
90 // 创建发送日志。如果模板被禁用,则不发送短信,只记录日志 90 // 创建发送日志。如果模板被禁用,则不发送短信,只记录日志
91 Boolean isSend = CommonStatusEnum.ENABLE.getStatus().equals(template.getStatus()); 91 Boolean isSend = CommonStatusEnum.ENABLE.getStatus().equals(template.getStatus());
  92 + String title = mailTemplateService.formatMailTemplateContent(template.getTitle(), templateParams);
92 String content = mailTemplateService.formatMailTemplateContent(template.getContent(), templateParams); 93 String content = mailTemplateService.formatMailTemplateContent(template.getContent(), templateParams);
93 Long sendLogId = mailLogService.createMailLog(userId, userType, mail, 94 Long sendLogId = mailLogService.createMailLog(userId, userType, mail,
94 account, template, content, templateParams, isSend); 95 account, template, content, templateParams, isSend);
95 // 发送 MQ 消息,异步执行发送短信 96 // 发送 MQ 消息,异步执行发送短信
96 if (isSend) { 97 if (isSend) {
97 mailProducer.sendMailSendMessage(sendLogId, mail, account.getId(), 98 mailProducer.sendMailSendMessage(sendLogId, mail, account.getId(),
98 - template.getNickname(), template.getTitle(), content); 99 + template.getNickname(), title, content);
99 } 100 }
100 return sendLogId; 101 return sendLogId;
101 } 102 }