|
|
|
|
@ -1,6 +1,5 @@
|
|
|
|
|
package org.dromara.web.listener;
|
|
|
|
|
|
|
|
|
|
import cn.dev33.satoken.config.SaTokenConfig;
|
|
|
|
|
import cn.dev33.satoken.listener.SaTokenListener;
|
|
|
|
|
import cn.dev33.satoken.stp.SaLoginModel;
|
|
|
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
|
|
|
@ -35,7 +34,6 @@ import java.time.Duration;
|
|
|
|
|
@Slf4j
|
|
|
|
|
public class UserActionListener implements SaTokenListener {
|
|
|
|
|
|
|
|
|
|
private final SaTokenConfig tokenConfig;
|
|
|
|
|
private final SysLoginService loginService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@ -59,10 +57,10 @@ public class UserActionListener implements SaTokenListener {
|
|
|
|
|
dto.setDeviceType(loginModel.getDevice());
|
|
|
|
|
dto.setDeptName((String) loginModel.getExtra(LoginHelper.DEPT_NAME_KEY));
|
|
|
|
|
TenantHelper.dynamic(tenantId, () -> {
|
|
|
|
|
if(tokenConfig.getTimeout() == -1) {
|
|
|
|
|
if(loginModel.getTimeout() == -1) {
|
|
|
|
|
RedisUtils.setCacheObject(CacheConstants.ONLINE_TOKEN_KEY + tokenValue, dto);
|
|
|
|
|
} else {
|
|
|
|
|
RedisUtils.setCacheObject(CacheConstants.ONLINE_TOKEN_KEY + tokenValue, dto, Duration.ofSeconds(tokenConfig.getTimeout()));
|
|
|
|
|
RedisUtils.setCacheObject(CacheConstants.ONLINE_TOKEN_KEY + tokenValue, dto, Duration.ofSeconds(loginModel.getTimeout()));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
// 记录登录日志
|
|
|
|
|
|