redis 短信发送

This commit is contained in:
zhangqinbin
2023-09-04 11:53:17 +08:00
parent c265d56ccd
commit 6b254cc181

View File

@ -60,7 +60,7 @@ public class BizShortMessageController{
log.info("解密前:"+vo.getMobile()); log.info("解密前:"+vo.getMobile());
String value = RSA.decrypt(vo.getMobile(),privateKey); String value = RSA.decrypt(vo.getMobile(),privateKey);
log.info("解密后:"+value); log.info("解密后:"+value);
String key = "mobile_code:" + value; String key = "mobilecode:" + value;
Object tokenValue = redisTemplate.opsForValue().get(key); Object tokenValue = redisTemplate.opsForValue().get(key);
if (tokenValue != null) { if (tokenValue != null) {
CommonExceptionEnum.FRAME_EXCEPTION_COMMON_DATA_OTHER_ERROR.assertNotNullByKey("验证码尚未失效",true); CommonExceptionEnum.FRAME_EXCEPTION_COMMON_DATA_OTHER_ERROR.assertNotNullByKey("验证码尚未失效",true);
@ -68,7 +68,7 @@ public class BizShortMessageController{
Boolean b = iBizShortMessageService.authCodeSend(value); Boolean b = iBizShortMessageService.authCodeSend(value);
if(b){ if(b){
Map<String, Object> map = JSONArray.parseObject(JSONArray.toJSONString(vo), Map.class); Map<String, Object> map = JSONArray.parseObject(JSONArray.toJSONString(vo), Map.class);
redisTemplate.opsForHash().putAll("mobile_code:" + value, map); redisTemplate.opsForHash().putAll(key, map);
redisTemplate.expire(key,30,TimeUnit.SECONDS); redisTemplate.expire(key,30,TimeUnit.SECONDS);
} }
return BaseResponse.success(b); return BaseResponse.success(b);