This commit is contained in:
N1KO 2025-01-03 09:42:34 +08:00
parent 918a93f93e
commit 8be32a2085

View File

@ -27,6 +27,7 @@ import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
import static top.baogutang.music.aspect.LoginAspect.AUTHORIZATION;
import static top.baogutang.music.constants.CacheKey.KEY_USER_LEVEL_PREFIX;
@ -86,11 +87,11 @@ public class VipAspect {
UserThreadLocal.set(userId);
String userLevelCacheKey = KEY_USER_LEVEL_PREFIX + userId;
UserLevel userLevel = CacheUtil.cacheOrSupply(userLevelCacheKey,
null,
null,
1L,
TimeUnit.HOURS,
redisTemplate,
() -> userService.queryUserLevel(userId),
new TypeReference<UserLevel>() {
new TypeReference<>() {
});
UserLevelThreadLocal.set(userLevel);
if (Objects.equals(UserLevel.NORMAL, userLevel)) {