Commit e231f17b by fanjiaxin

新加入实名认证相关代码

parent f6eae4e2
Pipeline #75484 passed with stages
in 1 minute 20 seconds
...@@ -78,13 +78,13 @@ public class SmsServiceImpl implements ISmsService { ...@@ -78,13 +78,13 @@ public class SmsServiceImpl implements ISmsService {
return false; return false;
} }
int sendIntervalSeconds = smsConfig.getSendIntervalSeconds(); int sendIntervalSeconds = smsConfig.getSendIntervalSeconds();
int codeValidSeconds = smsConfig.getCodeValidSeconds(); int codeValidMinutes = smsConfig.getCodeValidMinutes();
// 标记验证码已发送 // 标记验证码已发送
String sendCodeKey = String.format(SmsConstant.SMS_SEND_INTERVAL_KEY, scenes, mobilePhone); String sendCodeKey = String.format(SmsConstant.SMS_SEND_INTERVAL_KEY, scenes, mobilePhone);
redisClient.setStr(sendCodeKey, String.valueOf(System.currentTimeMillis()), sendIntervalSeconds); redisClient.setStr(sendCodeKey, String.valueOf(System.currentTimeMillis()), sendIntervalSeconds);
// 验证码放进缓存 // 验证码放进缓存
String codeKey = String.format(SmsConstant.SMS_CODE_KEY, scenes, mobilePhone); String codeKey = String.format(SmsConstant.SMS_CODE_KEY, scenes, mobilePhone);
redisClient.setStr(codeKey, code, codeValidSeconds); redisClient.setStr(codeKey, code, codeValidMinutes * 60);
return true; return true;
} }
......
...@@ -59,7 +59,7 @@ public class UasClientImpl implements IUasClient { ...@@ -59,7 +59,7 @@ public class UasClientImpl implements IUasClient {
private Map<String, Object> assembleSmsArg(String uid, String phone, String code, String scenes) { private Map<String, Object> assembleSmsArg(String uid, String phone, String code, String scenes) {
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("phone", phone); params.put("phone", phone);
params.put("message", String.format(smsConfig.getMessageFormat(), code, smsConfig.getCodeValidSeconds())); params.put("message", String.format(smsConfig.getMessageFormat(), code, smsConfig.getCodeValidMinutes()));
params.put("level", 1); params.put("level", 1);
params.put("uid", uid); params.put("uid", uid);
params.put("topic", String.format(TOPIC_FORMAT, scenes)); params.put("topic", String.format(TOPIC_FORMAT, scenes));
......
...@@ -27,10 +27,10 @@ public class SmsConfig { ...@@ -27,10 +27,10 @@ public class SmsConfig {
private Integer sendIntervalSeconds; private Integer sendIntervalSeconds;
/** /**
* 验证码有效时间,单位秒 * 验证码有效时间,分钟
*/ */
@Value("${sms.code.valid.seconds:300}") @Value("${sms.code.valid.minutes:5}")
private Integer codeValidSeconds; private Integer codeValidMinutes;
/** /**
* 验证码短信格式 * 验证码短信格式
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment