Browse Source

居民端-居民注册获取手机验证码

dev
sunyuchao 6 years ago
parent
commit
06764ee33f
  1. 14
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java
  2. 8
      epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserResiInfoRedis.java

14
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java

@ -135,4 +135,18 @@ public class RedisKeys {
return rootPrefix.concat("party:member:confirm:").concat(userId).concat("-").concat(mobile).concat("-").concat(code);
}
/**
*
* 居民注册手机验证码key
*
* @param userId 用户id
* @param mobile 手机号
* @param code 验证码
* @return String
* @author sun
*/
public static String getResiRegisterMobileCodeKey(String userId, String mobile, String code) {
return rootPrefix.concat("resiregister:confirm:").concat(userId).concat("-").concat(mobile).concat("-").concat(code);
}
}

8
epmet-user/epmet-user-server/src/main/java/com/epmet/redis/UserResiInfoRedis.java

@ -46,13 +46,13 @@ public class UserResiInfoRedis {
}
public void setUserResiMobileCode(String userId, String mobile, String verificationCode){
String key = RedisKeys.getUserMobileCodeKey(userId, mobile, verificationCode);
//手机验证码放入缓存中 有效时间10分钟
redisUtils.set(key, verificationCode,RedisUtils.MINUTE_TEN_EXPIRE);
String key = RedisKeys.getResiRegisterMobileCodeKey(userId, mobile, verificationCode);
//手机验证码放入缓存中 有效时间30分钟
redisUtils.set(key, verificationCode,RedisUtils.MINUTE_THIRTY_EXPIRE);
}
public String getUserResiMobileCode(String userId, String mobile, String verificationCode){
String key = RedisKeys.getUserMobileCodeKey(userId, mobile, verificationCode);
String key = RedisKeys.getResiRegisterMobileCodeKey(userId, mobile, verificationCode);
return (String) redisUtils.get(key);
}

Loading…
Cancel
Save