代码优化

This commit is contained in:
zhongzb
2023-05-04 21:24:36 +08:00
parent 8e4ad31ad0
commit c8369e31a1
6 changed files with 13 additions and 9 deletions

View File

@@ -80,7 +80,7 @@ public class JwtUtils {
public Long getUidOrNull(String token) {
return Optional.ofNullable(verifyToken(token))
.map(map -> map.get(UID_CLAIM))
.map(Claim::asLong)
.map(Claim::asLong)
.orElse(null);
}

View File

@@ -45,7 +45,7 @@ public class RedisUtils {
public static Long inc(String key, int time, TimeUnit unit) {
RedisScript<Long> redisScript = new DefaultRedisScript<>(LUA_INCR_EXPIRE, Long.class);
return stringRedisTemplate.execute(redisScript, Collections.singletonList(key), unit.toSeconds(time));
return stringRedisTemplate.execute(redisScript, Collections.singletonList(key), String.valueOf(unit.toSeconds(time)));
}
/**