mirror of
http://git.pig4cloud.com/pig/pigx.git
synced 2026-11-11 05:19:00 +08:00
🐛 Fixing a bug. #613 缓存支持不区分租户
This commit is contained in:
1 parent
93021656e2
commit
5d1cd5de75
6 files changed
+26
-17
No files matched your search
+2
-2
@@ -20,7 +20,7 @@ package com.pig4cloud.pigx.gateway.filter;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.pig4cloud.pigx.common.core.constant.CommonConstants;
|
||||
import com.pig4cloud.pigx.common.core.constant.CacheConstants;
|
||||
import com.pig4cloud.pigx.common.core.constant.SecurityConstants;
|
||||
import com.pig4cloud.pigx.common.core.constant.enums.LoginTypeEnum;
|
||||
import com.pig4cloud.pigx.common.core.exception.ValidateCodeException;
|
||||
@@ -129,7 +129,7 @@ public class ValidateCodeGatewayFilter extends AbstractGatewayFilterFactory {
|
||||
randomStr = mobile;
|
||||
}
|
||||
|
||||
String key = CommonConstants.DEFAULT_CODE_KEY + randomStr;
|
||||
String key = CacheConstants.DEFAULT_CODE_KEY + randomStr;
|
||||
redisTemplate.setKeySerializer(new StringRedisSerializer());
|
||||
|
||||
if (!redisTemplate.hasKey(key)) {
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
package com.pig4cloud.pigx.gateway.handler;
|
||||
|
||||
import com.google.code.kaptcha.Producer;
|
||||
import com.pig4cloud.pigx.common.core.constant.CacheConstants;
|
||||
import com.pig4cloud.pigx.common.core.constant.CommonConstants;
|
||||
import com.pig4cloud.pigx.common.core.constant.SecurityConstants;
|
||||
import lombok.AllArgsConstructor;
|
||||
@@ -62,8 +63,8 @@ public class ImageCodeHandler implements HandlerFunction<ServerResponse> {
|
||||
//保存验证码信息
|
||||
String randomStr = serverRequest.queryParam("randomStr").get();
|
||||
redisTemplate.setKeySerializer(new StringRedisSerializer());
|
||||
redisTemplate.opsForValue().set(CommonConstants.DEFAULT_CODE_KEY + randomStr, text
|
||||
, SecurityConstants.CODE_TIME, TimeUnit.SECONDS);
|
||||
redisTemplate.opsForValue().set(CacheConstants.DEFAULT_CODE_KEY + randomStr, text
|
||||
, SecurityConstants.CODE_TIME, TimeUnit.SECONDS);
|
||||
|
||||
// 转换流信息写出
|
||||
FastByteArrayOutputStream os = new FastByteArrayOutputStream();
|
||||
@@ -75,8 +76,8 @@ public class ImageCodeHandler implements HandlerFunction<ServerResponse> {
|
||||
}
|
||||
|
||||
return ServerResponse
|
||||
.status(HttpStatus.OK)
|
||||
.contentType(MediaType.IMAGE_JPEG)
|
||||
.body(BodyInserters.fromResource(new ByteArrayResource(os.toByteArray())));
|
||||
.status(HttpStatus.OK)
|
||||
.contentType(MediaType.IMAGE_JPEG)
|
||||
.body(BodyInserters.fromResource(new ByteArrayResource(os.toByteArray())));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user