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);
|
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);
|
this.save(regCustomer);
|
||||||
|
|
||||||
// 发送邮箱验证码
|
// 发送邮箱验证码
|
||||||
try {
|
if (CustomerConfigExpander.getSendEmailFlag()) {
|
||||||
SendMailParam regEmailParam = CustomerFactory.createRegEmailParam(regCustomer.getEmail(), regCustomer.getVerifyCode());
|
try {
|
||||||
mailSenderApi.sendMailHtml(regEmailParam);
|
SendMailParam regEmailParam = CustomerFactory.createRegEmailParam(regCustomer.getEmail(), regCustomer.getVerifyCode());
|
||||||
} catch (Exception exception) {
|
mailSenderApi.sendMailHtml(regEmailParam);
|
||||||
log.error("注册时,发送邮件失败!", exception);
|
} catch (Exception exception) {
|
||||||
throw new CustomerException(CustomerExceptionEnum.EMAIL_SEND_ERROR);
|
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);
|
this.updateById(customer);
|
||||||
|
|
||||||
// 发送邮箱验证码
|
// 发送邮箱验证码
|
||||||
SendMailParam resetPwdEmail = CustomerFactory.createResetPwdEmail(customerRequest.getEmail(), randomCode);
|
if (CustomerConfigExpander.getSendEmailFlag()) {
|
||||||
mailSenderApi.sendMailHtml(resetPwdEmail);
|
SendMailParam resetPwdEmail = CustomerFactory.createResetPwdEmail(customerRequest.getEmail(), randomCode);
|
||||||
|
mailSenderApi.sendMailHtml(resetPwdEmail);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue