Merge pull request #1928 from meqbyte/master

jwt剩余时间计算错误
This commit is contained in:
648540858 2025-07-28 08:32:24 +08:00 committed by GitHub
commit 49578e884f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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 {