提交 6c8b882b 编写于 作者: rushui.chen's avatar rushui.chen

20190918 测试双写模式

上级 ac7b9eb4
流水线 #14726 已失败 于阶段
in 0 second
......@@ -94,18 +94,31 @@ public class SysCodeController extends AccountBaseController {
if (remainTime > 0) {
throw new AccountException(AccountExceptionEnum.PICA_SYSCODE_RETRY.getCode(),
AccountExceptionEnum.PICA_SYSCODE_RETRY.getMessage().replace("X", String.valueOf(remainTime)));
} else {
processSendAuthCode(mobilePhone, flag, authCodeKeySecure);
}
} else {
String authCode = CommonUtil.createValidateCode();
String message = "您的验证码是" + authCode + ",在10分钟内有效。如非本人操作,请忽略本短信!";
AccountInfoEntity accountInfoEntity = accountInfoDetailMapper.selectByMobile(mobilePhone);
long senderId = accountInfoEntity == null ? 0L : accountInfoEntity.getId();
cacheClient.set(this.getAuthCodeKey(mobilePhone, flag.toString()), authCode, 600);
cacheClient.set(authCodeKeySecure, System.currentTimeMillis(), 60);
super.sendMobileMessage(mobilePhone, message, senderId);
processSendAuthCode(mobilePhone, flag, authCodeKeySecure);
}
}
/**
* 调用发送验证码的接口
*
* @param mobilePhone
* @param flag
* @param authCodeKeySecure
*/
private void processSendAuthCode(String mobilePhone, Integer flag, String authCodeKeySecure) {
String authCode = CommonUtil.createValidateCode();
String message = "您的验证码是" + authCode + ",在10分钟内有效。如非本人操作,请忽略本短信!";
AccountInfoEntity accountInfoEntity = accountInfoDetailMapper.selectByMobile(mobilePhone);
long senderId = accountInfoEntity == null ? 0L : accountInfoEntity.getId();
cacheClient.set(this.getAuthCodeKey(mobilePhone, flag.toString()), authCode, 600);
cacheClient.set(authCodeKeySecure, System.currentTimeMillis(), 60);
super.sendMobileMessage(mobilePhone, message, senderId);
}
//获取验证码redis key
private String getAuthCodeKey(String mobilePhone, String flag) {
return AUTH_CODE_PREFIX + flag + "-" + AESUtil.encryptV0(mobilePhone);
......
package com.pica.cloud.account.account.server.util;
import com.pica.cloud.foundation.encryption.util.EncryptUtils;
import com.pica.cloud.foundation.utils.utils.EncryptCreateUtil;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册