|
@@ -5,16 +5,15 @@ import cn.dev33.satoken.listener.SaTokenListener;
|
|
|
import cn.dev33.satoken.stp.SaLoginModel;
|
|
|
import cn.hutool.http.useragent.UserAgent;
|
|
|
import cn.hutool.http.useragent.UserAgentUtil;
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.dromara.common.core.constant.CacheConstants;
|
|
|
import org.dromara.common.core.domain.dto.UserOnlineDTO;
|
|
|
import org.dromara.common.core.domain.model.LoginUser;
|
|
|
-import org.dromara.common.core.enums.UserType;
|
|
|
+import org.dromara.common.core.utils.ServletUtils;
|
|
|
+import org.dromara.common.core.utils.ip.AddressUtils;
|
|
|
import org.dromara.common.redis.utils.RedisUtils;
|
|
|
import org.dromara.common.satoken.utils.LoginHelper;
|
|
|
-import org.dromara.common.core.utils.ip.AddressUtils;
|
|
|
-import org.dromara.common.core.utils.ServletUtils;
|
|
|
-import lombok.RequiredArgsConstructor;
|
|
|
-import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.time.Duration;
|
|
@@ -36,8 +35,8 @@ public class UserActionListener implements SaTokenListener {
|
|
|
*/
|
|
|
@Override
|
|
|
public void doLogin(String loginType, Object loginId, String tokenValue, SaLoginModel loginModel) {
|
|
|
- UserType userType = UserType.getUserType(loginId.toString());
|
|
|
- if (userType == UserType.SYS_USER) {
|
|
|
+ /*UserType userType = UserType.getUserType(loginId.toString());
|
|
|
+ if (userType == UserType.SYS_USER) {*/
|
|
|
UserAgent userAgent = UserAgentUtil.parse(ServletUtils.getRequest().getHeader("User-Agent"));
|
|
|
String ip = ServletUtils.getClientIP();
|
|
|
LoginUser user = LoginHelper.getLoginUser();
|
|
@@ -56,9 +55,9 @@ public class UserActionListener implements SaTokenListener {
|
|
|
RedisUtils.setCacheObject(CacheConstants.ONLINE_TOKEN_KEY + tokenValue, dto, Duration.ofSeconds(tokenConfig.getTimeout()));
|
|
|
}
|
|
|
log.info("user doLogin, userId:{}, token:{}", loginId, tokenValue);
|
|
|
- } else if (userType == UserType.APP_USER) {
|
|
|
+/* } else if (userType == UserType.APP_USER) {
|
|
|
// app端 自行根据业务编写
|
|
|
- }
|
|
|
+ }*/
|
|
|
}
|
|
|
|
|
|
/**
|