From a395d1972e34bb362f7b1b6039219e9bd66fc04e Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Tue, 5 Sep 2023 10:00:01 +0800 Subject: [PATCH] fix --- server/websocket/internal/logic/datatransferlogic.go | 6 ++++++ server/websocket/internal/logic/ws_reuse_last_connect.go | 3 +++ 2 files changed, 9 insertions(+) diff --git a/server/websocket/internal/logic/datatransferlogic.go b/server/websocket/internal/logic/datatransferlogic.go index 7a674a1f..264dbb3c 100644 --- a/server/websocket/internal/logic/datatransferlogic.go +++ b/server/websocket/internal/logic/datatransferlogic.go @@ -316,6 +316,9 @@ func ConsumeUserPoolData(ctx context.Context) { // 获取mapUserConnPool唯一id func getmapUserConnPoolUniqueId(userId, guestId int64) (uniqueId string) { + if userId > 0 { + guestId = 0 + } return fmt.Sprintf("%d_%d", userId, guestId) } @@ -348,6 +351,9 @@ func (l *DataTransferLogic) checkAuth(r *http.Request) (isAuth bool, userInfo *a if err != nil { return false, nil } + if userInfo.UserId > 0 { + userInfo.GuestId = 0 + } //白板用户 return true, userInfo } diff --git a/server/websocket/internal/logic/ws_reuse_last_connect.go b/server/websocket/internal/logic/ws_reuse_last_connect.go index faaa062c..7df5c4b4 100644 --- a/server/websocket/internal/logic/ws_reuse_last_connect.go +++ b/server/websocket/internal/logic/ws_reuse_last_connect.go @@ -75,5 +75,8 @@ func (r *reuseConnProcessor) allocationMessage(w *wsConnectItem, data []byte) { // 获取用户拼接部分(复用标识用到) func getUserJoinPart(userId, guestId int64, userAgent string) string { + if userId > 0 { + guestId = 0 + } return fmt.Sprintf("|_%d_%d_|_%s_|", userId, guestId, userAgent) }