【7.0.4】更新邮件发送错误的日志

pull/22/head
fengshuonan 2021-06-09 17:12:31 +08:00
parent 16a0f7e5ab
commit 771e7d1c2c
2 changed files with 15 additions and 3 deletions

View File

@ -66,7 +66,12 @@ public enum CustomerExceptionEnum implements AbstractExceptionEnum {
/**
*
*/
EMAIL_VERIFY_COD_ERROR(RuleConstants.BUSINESS_ERROR_TYPE_CODE + CustomerConstants.CUSTOMER_EXCEPTION_STEP_CODE + "06", "邮箱验证码错误,请重新输入邮箱验证码");
EMAIL_VERIFY_COD_ERROR(RuleConstants.BUSINESS_ERROR_TYPE_CODE + CustomerConstants.CUSTOMER_EXCEPTION_STEP_CODE + "06", "邮箱验证码错误,请重新输入邮箱验证码"),
/**
*
*/
EMAIL_SEND_ERROR(RuleConstants.BUSINESS_ERROR_TYPE_CODE + CustomerConstants.CUSTOMER_EXCEPTION_STEP_CODE + "07", "注册失败,网络异常!请联系管理员!");
/**
*

View File

@ -39,6 +39,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -53,6 +54,7 @@ import java.util.List;
* @date 2021/06/07 11:40
*/
@Service
@Slf4j
public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> implements CustomerService {
/**
@ -97,8 +99,13 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
this.save(regCustomer);
// 发送邮箱验证码
SendMailParam regEmailParam = CustomerFactory.createRegEmailParam(regCustomer.getEmail(), regCustomer.getVerifyCode());
mailSenderApi.sendMailHtml(regEmailParam);
try {
SendMailParam regEmailParam = CustomerFactory.createRegEmailParam(regCustomer.getEmail(), regCustomer.getVerifyCode());
mailSenderApi.sendMailHtml(regEmailParam);
} catch (Exception exception) {
log.error("注册时,发送邮件失败!", exception);
throw new CustomerException(CustomerExceptionEnum.EMAIL_SEND_ERROR);
}
}
}