feat 网关鉴权

This commit is contained in:
2025-12-22 18:04:36 +08:00
parent 69cc960fe5
commit 670140e7d3
68 changed files with 1424 additions and 492 deletions

View File

@@ -22,17 +22,17 @@ type Client struct {
cancel context.CancelFunc // 取消上下文
heartBeat time.Time // 最后一次心跳
UID int32 // 用户ID
USN int64 // 用户ID
SceneSID int64 // 场景服ID
InstanceID int32 // 副本ID副本类型
UniqueNo int64 // 副本唯一编号
}
func NewClient(uid int32, conn socket.ISocketConn) *Client {
func NewClient(usn int64, conn socket.ISocketConn) *Client {
client := &Client{
UID: uid,
USN: usn,
conn: conn,
logger: log.GetLogger().Named(fmt.Sprintf("uid:%v", uid)),
logger: log.GetLogger().Named(fmt.Sprintf("usn:%v", usn)),
heartBeat: time.Now(),
mailChan: make(chan Event, 1024),
}
@@ -99,7 +99,7 @@ func (c *Client) onClose() {
close(c.mailChan)
c.mailChan = nil
}
UserMgr.Delete(c.UID)
UserMgr.Delete(c.USN)
c.onLeave()
c.Done()
}