mirror of
https://github.com/continew-org/continew-admin.git
synced 2025-09-11 06:57:12 +08:00
chore: continew-starter 2.1.0 => 2.1.1
1、IpUtils 获取 IPv4 归属地方法重命名 2、CurrentUserProvider => WebSocketClientService
This commit is contained in:
@@ -64,12 +64,6 @@
|
||||
<artifactId>continew-starter-auth-justauth</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- ContiNew Starter 认证模块 - SaToken -->
|
||||
<dependency>
|
||||
<groupId>top.continew</groupId>
|
||||
<artifactId>continew-starter-auth-satoken</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- ContiNew Starter 数据访问模块 - MyBatis Plus -->
|
||||
<dependency>
|
||||
<groupId>top.continew</groupId>
|
||||
@@ -86,6 +80,12 @@
|
||||
<dependency>
|
||||
<groupId>top.continew</groupId>
|
||||
<artifactId>continew-starter-messaging-websocket</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- ContiNew Starter 消息模块 - 邮件 -->
|
||||
|
@@ -21,8 +21,7 @@ import org.springframework.http.server.ServletServerHttpRequest;
|
||||
import org.springframework.stereotype.Component;
|
||||
import top.continew.admin.common.model.dto.LoginUser;
|
||||
import top.continew.admin.common.util.helper.LoginHelper;
|
||||
import top.continew.starter.messaging.websocket.core.CurrentUserProvider;
|
||||
import top.continew.starter.messaging.websocket.model.CurrentUser;
|
||||
import top.continew.starter.messaging.websocket.core.WebSocketClientService;
|
||||
|
||||
/**
|
||||
* 当前登录用户 Provider
|
||||
@@ -31,15 +30,13 @@ import top.continew.starter.messaging.websocket.model.CurrentUser;
|
||||
* @since 2024/6/4 22:13
|
||||
*/
|
||||
@Component
|
||||
public class CurrentUserProviderImpl implements CurrentUserProvider {
|
||||
public class WebSocketClientServiceImpl implements WebSocketClientService {
|
||||
|
||||
@Override
|
||||
public CurrentUser getCurrentUser(ServletServerHttpRequest request) {
|
||||
public String getClientId(ServletServerHttpRequest request) {
|
||||
HttpServletRequest servletRequest = request.getServletRequest();
|
||||
String token = servletRequest.getParameter("token");
|
||||
LoginUser loginUser = LoginHelper.getLoginUser(token);
|
||||
CurrentUser currentUser = new CurrentUser();
|
||||
currentUser.setUserId(loginUser.getToken());
|
||||
return currentUser;
|
||||
return loginUser.getToken();
|
||||
}
|
||||
}
|
@@ -55,7 +55,7 @@ public class LoginHelper {
|
||||
// 记录登录信息
|
||||
HttpServletRequest request = ServletUtils.getRequest();
|
||||
loginUser.setIp(JakartaServletUtil.getClientIP(request));
|
||||
loginUser.setAddress(IpUtils.getAddress(loginUser.getIp()));
|
||||
loginUser.setAddress(ExceptionUtils.exToNull(() -> IpUtils.getIpv4Address(loginUser.getIp())));
|
||||
loginUser.setBrowser(ServletUtils.getBrowser(request));
|
||||
loginUser.setLoginTime(LocalDateTime.now());
|
||||
loginUser.setOs(StrUtil.subBefore(ServletUtils.getOs(request), " or", false));
|
||||
|
Reference in New Issue
Block a user