即将过期状态判断错误

This commit is contained in:
Jerry Yan
2025-06-11 14:46:16 +08:00
parent a948b78629
commit 5aaa1c016b

View File

@@ -231,7 +231,7 @@ public class JwtUtils implements InitializingBean {
if (expirationTime != null) {
// 判断是否即将过期, 默认剩余时间小于5分钟未即将过期
// 剩余时间 (秒)
long timeRemaining = LocalDateTime.now().toEpochSecond(ZoneOffset.ofHours(8)) - expirationTime.getValue();
long timeRemaining = expirationTime.getValue() - LocalDateTime.now().toEpochSecond(ZoneOffset.ofHours(8));
if (timeRemaining < 5 * 60) {
jwtUser.setStatus(JwtUser.TokenStatus.EXPIRING_SOON);
} else {