fix: 友链保存空指针校验

This commit is contained in:
裴浩宇 2024-04-09 09:15:45 +08:00
parent fab23bbfca
commit 8fe5f81f1c

View File

@ -93,7 +93,7 @@ public class PxFriendLinkServiceImpl implements IPxFriendLinkService {
throw new ServiceException("发送邮件异常");
}
}
if ("2".equals(pxFriendLink.getStatus())) {
if ("2".equals(pxFriendLink.getStatus()) && StringUtils.isNotNull(pxFriendLink.getEmail())) {
// 改为失效的友链
SysEmail sysEmail = new SysEmail();
String activationTemplate = TemplateUtils.getTemplate("link");
@ -104,7 +104,7 @@ public class PxFriendLinkServiceImpl implements IPxFriendLinkService {
activationTemplate = activationTemplate.replace("template-lineImg", pxFriendLink.getImg());
activationTemplate = activationTemplate.replace("template-lineEmail", pxFriendLink.getEmail());
sysEmail.setReceiverEmail(pxFriendLink.getEmail());
sysEmail.setSubject("\uD83D\uDC49 叮咚「Pei你看雪博客」上有人申请友链");
sysEmail.setSubject("\uD83D\uDC49 叮咚「Pei你看雪博客」上您的友链已失效");
sysEmail.setContent(activationTemplate);
try {
sysEmailService.sendMail(sysEmail);