升级依赖库

This commit is contained in:
2024-07-22 16:40:33 +08:00
parent b4444c778e
commit 726f6b5911
8 changed files with 47 additions and 203 deletions

View File

@ -9,6 +9,7 @@ package context
import (
"fmt"
"git.zhangdeman.cn/zhangdeman/wrapper"
"strings"
"time"
@ -16,7 +17,7 @@ import (
"git.zhangdeman.cn/zhangdeman/easymap"
"git.zhangdeman.cn/zhangdeman/util"
"git.zhangdeman.cn/zhangdeman/network/util"
"github.com/gin-gonic/gin"
"gopkg.in/olahol/melody.v1"
)
@ -43,7 +44,7 @@ type WSContext struct {
//
// Date : 7:15 下午 2021/3/27
func NewContext(ginCtx *gin.Context, flag string, session *melody.Session) *WSContext {
d, _ := easymap.NewSegment(128, true)
d, _ := easymap.NewSegment(128)
l, _ := easylock.NewSegment(128)
return &WSContext{
ConnectionID: generateConnectionID(flag),
@ -57,7 +58,7 @@ func NewContext(ginCtx *gin.Context, flag string, session *melody.Session) *WSCo
}
}
//CloneContext 克隆上下文信息
// CloneContext 克隆上下文信息
//
// Author : go_developer@163.com<白茶清欢>
//
@ -88,5 +89,6 @@ func generateConnectionID(flag string) string {
flag,
strings.ReplaceAll(util.IP.GetHostIP(), ".", ""),
time.Now().Format("20060102150405"),
util.String.Md5(fmt.Sprintf("%d", time.Now().UnixNano())+util.String.GenRandom("", 64)))
wrapper.String(fmt.Sprintf("%d", time.Now().UnixNano())+wrapper.StringFromRandom(64, "").Value()).Md5(),
)
}