【7.2.3】更新C端业务是否开启发送邮件的标识

pull/30/head
fengshuonan 2022-06-28 15:56:38 +08:00
parent f9437e510b
commit 541d44fda3
2 changed files with 24 additions and 8 deletions

View File

@ -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);
}
} }

View File

@ -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