fix: token超时时间计算错误

This commit is contained in:
fit2cloud-chenyw 2022-01-14 15:19:31 +08:00
parent 7a61f375fa
commit 563d7bee95

View File

@ -17,16 +17,13 @@ import org.springframework.core.env.Environment;
import java.util.Date;
public class JWTUtils {
// token过期时间1min (过期会自动刷新续命 目的是避免一直都是同一个token )
private static final long EXPIRE_TIME = 1 * 60 * 1000;
// 登录间隔时间10min 超过这个时间强制重新登录
private static long Login_Interval;
/**
* 校验token是否正确
*
@ -82,7 +79,8 @@ public class JWTUtils {
public static boolean loginExpire(String token) {
if (Login_Interval == 0) {
// 默认超时时间是8h
int minute = CommonBeanFactory.getBean(Environment.class).getProperty("dataease.login_timeout", Integer.class, 8 * 60);
Long minute = CommonBeanFactory.getBean(Environment.class).getProperty("dataease.login_timeout", Long.class,
8 * 60L);
// 分钟换算成毫秒
Login_Interval = minute * 1000 * 60;
}