|
|
@@ -52,7 +52,7 @@ public class AuthCodeServiceImpl implements AuthCodeService {
|
|
|
try{
|
|
|
|
|
|
//生成一个6位验证码
|
|
|
- String authCode = String.valueOf(((Math.random() * 9 + 1) * 100000));
|
|
|
+ String authCode = StringUtils.left(String.valueOf(((Math.random() * 9 + 1) * 100000)), 6);
|
|
|
Boolean sendResult = commonInformService.sendMessage(AUTH_CODE_MESSAGE_TEMPLATE, getMessage(authCode, authCodeDTO));
|
|
|
if (Boolean.TRUE.equals(sendResult)) {
|
|
|
redisTemplate.opsForValue().set(AUTH_CODE_CACHE_KEY + authCodeDTO.getEmail(), authCode, 5, TimeUnit.MINUTES);
|
|
|
@@ -69,6 +69,7 @@ public class AuthCodeServiceImpl implements AuthCodeService {
|
|
|
|
|
|
private AbstractBaseInformMessage getMessage(String authCode, AuthCodeDTO authCodeDTO) {
|
|
|
if (StringUtils.isNotBlank(authCodeDTO.getEmail())) {
|
|
|
+ log.info("email auth code");
|
|
|
EmailInformMessage emailInformMessage = new EmailInformMessage();
|
|
|
Map<String, String> params = new HashMap<>(1);
|
|
|
params.put("\\{MSR_AUTH_CODE}", String.valueOf(authCode));
|
|
|
@@ -76,6 +77,7 @@ public class AuthCodeServiceImpl implements AuthCodeService {
|
|
|
emailInformMessage.setAddressees(Collections.singletonList(authCodeDTO.getEmail()));
|
|
|
return emailInformMessage;
|
|
|
} else {
|
|
|
+ log.info("sms auth code");
|
|
|
SmsInformMessage smsInformMessage = new SmsInformMessage();
|
|
|
Map<String, String> params = new HashMap<>(1);
|
|
|
params.put("MSRcode", String.valueOf(authCode));
|