Skip to content

Commit

Permalink
refactor: 适配 ContiNew Starter WebSocket 模块(消息模块)
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles7c committed Jun 5, 2024
1 parent 51d05a2 commit 94168e2
Show file tree
Hide file tree
Showing 14 changed files with 74 additions and 653 deletions.
11 changes: 6 additions & 5 deletions continew-admin-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@
<artifactId>continew-starter-cache-jetcache</artifactId>
</dependency>

<!-- ContiNew Starter 消息模块 - WebSocket -->
<dependency>
<groupId>top.continew</groupId>
<artifactId>continew-starter-messaging-websocket</artifactId>
</dependency>

<!-- ContiNew Starter 消息模块 - 邮件 -->
<dependency>
<groupId>top.continew</groupId>
Expand Down Expand Up @@ -135,10 +141,5 @@
<groupId>top.continew</groupId>
<artifactId>continew-starter-json-jackson</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>

</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright (c) 2022-present Charles7c Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package top.continew.admin.common.config.websocket;

import cn.hutool.core.convert.Convert;
import jakarta.servlet.http.HttpServletRequest;
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;

/**
* 当前登录用户 Provider
*
* @author Charles7c
* @since 2024/6/4 22:13
*/
@Component
public class CurrentUserProviderImpl implements CurrentUserProvider {

@Override
public CurrentUser getCurrentUser(ServletServerHttpRequest request) {
HttpServletRequest servletRequest = request.getServletRequest();
String token = servletRequest.getParameter("token");
LoginUser loginUser = LoginHelper.getLoginUser(token);
CurrentUser currentUser = new CurrentUser();
currentUser.setUserId(Convert.toStr(loginUser.getId()));
return currentUser;
}
}

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 94168e2

Please sign in to comment.