mirror of https://gitee.com/stylefeng/roses
【7.2.3】更新C端业务是否开启发送邮件的标识
parent
f9437e510b
commit
541d44fda3
|
@ -91,4 +91,16 @@ public class CustomerConfigExpander {
|
|||
return ConfigContext.me().getSysConfigValueWithDefault("CUSTOMER_OPEN_OLD_PASSWORD_VALIDATE", Boolean.class, Boolean.FALSE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取是否开启了发送邮件的开关
|
||||
* <p>
|
||||
* 如果开启了,则发送用户注册、找回密码等业务的邮件,未开启则不发送
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2022/6/28 15:38
|
||||
*/
|
||||
public static boolean getSendEmailFlag() {
|
||||
return ConfigContext.me().getSysConfigValueWithDefault("SYS_CUSTOMER_SEND_EMAIL", Boolean.class, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -129,12 +129,14 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
|
|||
this.save(regCustomer);
|
||||
|
||||
// 发送邮箱验证码
|
||||
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);
|
||||
if (CustomerConfigExpander.getSendEmailFlag()) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -251,8 +253,10 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
|
|||
this.updateById(customer);
|
||||
|
||||
// 发送邮箱验证码
|
||||
SendMailParam resetPwdEmail = CustomerFactory.createResetPwdEmail(customerRequest.getEmail(), randomCode);
|
||||
mailSenderApi.sendMailHtml(resetPwdEmail);
|
||||
if (CustomerConfigExpander.getSendEmailFlag()) {
|
||||
SendMailParam resetPwdEmail = CustomerFactory.createResetPwdEmail(customerRequest.getEmail(), randomCode);
|
||||
mailSenderApi.sendMailHtml(resetPwdEmail);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue