1
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

This commit is contained in:
昔念
2026-02-08 02:11:46 +08:00
parent af29b13ba4
commit 2b25ae6b35
9 changed files with 64 additions and 44 deletions

View File

@@ -14,6 +14,7 @@ import (
blazing "blazing/modules/player/service"
playerservice "blazing/modules/player/service"
"github.com/deatil/go-cryptobin/cryptobin/crypto"
"github.com/gogf/gf/v2/database/gdb"
"github.com/gogf/gf/v2/frame/g"
)
@@ -70,8 +71,16 @@ func (c *BaseSysUserController) GetSession(ctx context.Context, req *SessionReq)
res.PetID = dict.NewDictInfoService().GetShiny()
res.Server = config.NewServerService().GetPort(int(t1.Debug))
// share.ShareManager.DeleteSession(t1)
res.Session = blazing.NewInfoService(uint32(t.UserId)).Gensession()
cypten := crypto.
FromString(blazing.NewInfoService(uint32(t.UserId)).Gensession()).
SetKey("gfertf12dfertf12").
SetIv("gfertf12dfertf12").
Aes().
CBC().
PKCS7Padding().
Encrypt().
ToBase64String()
res.Session = cypten
return
}

View File

@@ -1,6 +1,6 @@
module blazing/modules/base
go 1.20
go 1.24.0
require (
github.com/gogf/gf/v2 v2.8.0
@@ -9,6 +9,7 @@ require (
)
require (
github.com/deatil/go-cryptobin v1.1.1013 // indirect
github.com/dolthub/maphash v0.1.0 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/ipipdotnet/ipdb-go v1.3.3 // indirect

View File

@@ -5,6 +5,8 @@ github.com/clbanning/mxj/v2 v2.7.0/go.mod h1:hNiWqW14h+kc+MdF9C6/YoRfjEJoR3ou6tn
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/deatil/go-cryptobin v1.1.1013 h1:SF4uNijMfuW42Ir8q1YusgSONGbEqlCeXbSbBUkUImE=
github.com/deatil/go-cryptobin v1.1.1013/go.mod h1:x+/+SzyfbxliY2y0Fwe+OoLU0DEt9kWs6OMiwghcfJ0=
github.com/dolthub/maphash v0.1.0 h1:bsQ7JsF4FkkWyrP3oCnFJgrCUAFbFf3kOl4L/QxPDyQ=
github.com/dolthub/maphash v0.1.0/go.mod h1:gkg4Ch4CdCDu5h6PMriVLawB7koZ+5ijb9puGMV50a4=
github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc=

View File

@@ -9,8 +9,6 @@ import (
"encoding/hex"
"fmt"
"strings"
"time"
"github.com/gogf/gf/v2/os/glog"
@@ -143,12 +141,10 @@ var User = csmap.New[string, uint32](
// 会话ID由accountID(4字节) + UUID(16字节) + 随机数(4字节)组成,最终编码为十六进制字符串
func (s *InfoService) Gensession() string {
uuidV7, _ := uuid.NewV7()
uuidBytes := uuidV7[:] // UUID 类型底层是 [16]byte直接切片获取
// 移除UUID中的连字符便于后续处理
uuidStr := strings.ReplaceAll(uuidV7.String(), "-", "")
// // 解码UUID字符串为字节数组32位十六进制字符串对应16字节
uuidBytes, _ := hex.DecodeString(uuidStr)
// 3. 计算 CRC32-IEEE 校验码最通用的CRC32标准
sessionID := hex.EncodeToString(uuidBytes)