♻️ Refactoring code. 统一 RedisTemplate 序列化规则
This commit is contained in:
1 parent
e0fd01d74b
commit
96e1df004f
3 files changed
+7
-5
No files matched your search
+3
-2
@@ -18,6 +18,7 @@
|
||||
package com.pig4cloud.pigx.app.service.impl;
|
||||
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.pig4cloud.pigx.app.service.AppMobileService;
|
||||
import com.pig4cloud.pigx.common.core.constant.CacheConstants;
|
||||
@@ -53,10 +54,10 @@ public class AppMobileServiceImpl implements AppMobileService {
|
||||
*/
|
||||
@Override
|
||||
public R<Boolean> sendSmsCode(String mobile) {
|
||||
Object codeObj = redisTemplate.opsForValue()
|
||||
String codeObj = redisTemplate.opsForValue()
|
||||
.get(CacheConstants.DEFAULT_CODE_KEY + LoginTypeEnum.APPSMS.getType() + StringPool.AT + mobile);
|
||||
|
||||
if (codeObj != null) {
|
||||
if (StrUtil.isNotBlank(codeObj)) {
|
||||
log.info("手机号验证码未过期:{},{}", mobile, codeObj);
|
||||
return R.ok(Boolean.FALSE, MsgUtils.getMessage(ErrorCodes.SYS_APP_SMS_OFTEN));
|
||||
}
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ public class ImageCodeMathHandler implements HandlerFunction<ServerResponse> {
|
||||
|
||||
private static final Integer DEFAULT_IMAGE_HEIGHT = 40;
|
||||
|
||||
private final RedisTemplate redisTemplate;
|
||||
private final RedisTemplate<String,String> redisTemplate;
|
||||
|
||||
@Override
|
||||
public Mono<ServerResponse> handle(ServerRequest serverRequest) {
|
||||
|
||||
+3
-2
@@ -19,6 +19,7 @@ package com.pig4cloud.pigx.admin.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.pig4cloud.pigx.admin.api.entity.SysUser;
|
||||
@@ -68,10 +69,10 @@ public class MobileServiceImpl implements MobileService {
|
||||
return R.ok(Boolean.FALSE, MsgUtils.getMessage(ErrorCodes.SYS_APP_PHONE_UNREGISTERED, mobile));
|
||||
}
|
||||
|
||||
Object codeObj = redisTemplate.opsForValue()
|
||||
String codeObj = redisTemplate.opsForValue()
|
||||
.get(CacheConstants.DEFAULT_CODE_KEY + LoginTypeEnum.SMS.getType() + StringPool.AT + mobile);
|
||||
|
||||
if (codeObj != null) {
|
||||
if (StrUtil.isNotBlank(codeObj)) {
|
||||
log.info("手机号验证码未过期:{},{}", mobile, codeObj);
|
||||
return R.ok(Boolean.FALSE, MsgUtils.getMessage(ErrorCodes.SYS_APP_SMS_OFTEN));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user