Compare commits

...

2 Commits

Author SHA1 Message Date
ayflying
504836d165 绑定用户凭证 2025-04-29 10:16:25 +08:00
ayflying
e9962f1b74 修改act数据取出的时候进行泛型复制而不是转格式 2025-04-25 11:28:18 +08:00
2 changed files with 9 additions and 3 deletions

View File

@@ -9,6 +9,7 @@ import (
service2 "github.com/ayflying/utility_go/service"
"github.com/ayflying/utility_go/tools"
"github.com/gogf/gf/v2/container/gset"
"github.com/gogf/gf/v2/container/gvar"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gctx"
"github.com/gogf/gf/v2/os/gtime"
@@ -63,8 +64,11 @@ func (s *sGameAct) Info(uid int64, actId int) (data *g.Var, err error) {
Uid: uid,
ActId: actId,
}).Fields("action").OrderDesc("updated_at").Value()
getDb.Scan(&data)
//getDb.Scan(&data)
if getDb == nil || getDb.IsEmpty() {
return
}
data = gvar.New(getDb)
if data == nil || data.IsEmpty() {
return
}

View File

@@ -35,6 +35,7 @@ type WebsocketData struct {
Ws *websocket.Conn `json:"ws" dc:"websocket连接池"`
Uuid string `json:"uuid" dc:"用户唯一标识"`
Uid int64 `json:"uid" dc:"用户编号"`
Guid string `json:"guid" dc:"用户凭证"`
Groups []string `json:"groups" dc:"群组"`
Ctx context.Context `json:"ctx" dc:""`
RoomId string `json:"roomId" dc:"房间编号"`
@@ -169,7 +170,7 @@ func (s *SocketV1) OnMessage(conn *WebsocketData, req []byte, msgType int) {
}
//绑定用户编号
func (s *SocketV1) BindUid(conn *WebsocketData, uid int64) {
func (s *SocketV1) BindUid(conn *WebsocketData, uid int64, guid string) {
lock.Lock()
defer lock.Unlock()
@@ -179,6 +180,7 @@ func (s *SocketV1) BindUid(conn *WebsocketData, uid int64) {
if conn.Uid == 0 {
conn.Uid = uid
}
conn.Guid = guid
}