diff --git a/server/websocket/internal/logic/datatransferlogic.go b/server/websocket/internal/logic/datatransferlogic.go index 949df11b..1aa2e8e4 100644 --- a/server/websocket/internal/logic/datatransferlogic.go +++ b/server/websocket/internal/logic/datatransferlogic.go @@ -190,7 +190,7 @@ func (l *DataTransferLogic) setConnPool(conn *websocket.Conn, userInfo *auth.Use } lendecryptionWid := len(decryptionWid) //合成client后缀,不是同个后缀的不能复用 - userPart := getUserJoinPart(userInfo.UserId, userInfo.GuestId, userAgent) + userPart := getUserPart(userInfo.UserId, userInfo.GuestId, userAgent) lenUserPart := len(userPart) //长度太短 if lendecryptionWid <= lenUserPart { @@ -263,7 +263,7 @@ func (l *DataTransferLogic) getUniqueId(userInfo *auth.UserInfo, userAgent strin return "", errors.New("failed to get unique id") } //后面拼接上用户id - uniqueId = hex.EncodeToString([]byte(uuid.New().String())) + getUserJoinPart(userInfo.UserId, userInfo.GuestId, userAgent) + uniqueId = hex.EncodeToString([]byte(uuid.New().String())) + getUserPart(userInfo.UserId, userInfo.GuestId, userAgent) //存在则从新获取 if _, ok := mapConnPool.Load(uniqueId); ok { uniqueId, err = l.getUniqueId(userInfo, userAgent, retryTimes-1) @@ -445,7 +445,7 @@ func (w *wsConnectItem) respondDataFormat(msgType constants.Websocket, data inte } // 获取用户拼接部分(复用标识用到) -func getUserJoinPart(userId, guestId int64, userAgent string) string { +func getUserPart(userId, guestId int64, userAgent string) string { if userId > 0 { guestId = 0 }