jiaoyan改为5秒内不可重复请求

This commit is contained in:
houjishuang
2025-06-20 16:56:49 +08:00
parent 9ca2d061c7
commit 46b3ca6e71
2 changed files with 4 additions and 4 deletions

View File

@ -190,10 +190,10 @@ public class TokenAuthenticationFilter extends OncePerRequestFilter {
log.error("请求连接已使用过");
b = false;
}else{
redisTemplate.opsForValue().set(HEADER_CHECK_TOKEN+":"+cookieKey, 2, 20, TimeUnit.SECONDS);
redisTemplate.opsForValue().set(HEADER_CHECK_TOKEN+":"+cookieKey, 2, 5, TimeUnit.SECONDS);
}
}else{
redisTemplate.opsForValue().set(HEADER_CHECK_TOKEN+":"+cookieKey, 1, 20, TimeUnit.SECONDS);
redisTemplate.opsForValue().set(HEADER_CHECK_TOKEN+":"+cookieKey, 1, 5, TimeUnit.SECONDS);
}
String header = request.getHeader(AUTHORIZATION_HEADER);//请求头token

View File

@ -34,7 +34,7 @@ public class UserInfoServiceImpl implements UserInfoService {
private @Autowired
UnifastOAuthClient client;
// private @Autowired ObjectMapper userInfoObjectMapper;
@Value("${login.token.time_limit}")
@Value("${login.token.time_limit:3}")
private Integer valid_time_limit;
@Autowired()
@Qualifier("userinfoRedisTemplate")
@ -61,7 +61,7 @@ private Integer valid_time_limit;
BaseCacheUser user = structureUser(token);
redisTemplate.opsForValue().set(REDIS_USER_KEY + token, user, valid_time_limit, TimeUnit.MINUTES);
redisTemplate.opsForValue().set(REDIS_USER_KEY + token, user, valid_time_limit-1, TimeUnit.MINUTES);
return user;
}