refactor(common): 重构 common 模块

- 移除 global.go 文件
- 更新 player.go 中的玩家数据存储方式
- 删除 session.go 文件
- 调整 rpc.go 中的 RPC 客户端方法
- 更新 ServerEvent.go 中的会话管理
- 调整 controller 中的 Maincontroller 结构
- 更新 login.go 中的用户登录逻辑
- 调整 service 中的玩家数据获取方式
- 更新 admin/login.go 和 login.go 中的会话管理
This commit is contained in:
2025-07-15 12:14:17 +08:00
parent 43a726006c
commit 7a87bfa089
13 changed files with 208 additions and 80 deletions

View File

@@ -1,7 +1,7 @@
package entity
import (
"blazing/common/core"
"blazing/cool"
"github.com/panjf2000/gnet/v2"
)
@@ -48,10 +48,8 @@ func (p *Player) SendPack(b []byte) error {
func ConutPlayer() int {
// v := reflect.ValueOf(&core.Mainplayer).Elem().FieldByName("m").Elem()
// return int(v.FieldByName("count").Int())
count := 0
core.Mainplayer.Range(func(key, value interface{}) bool {
cool.Mainplayer.Range(func(key, value interface{}) bool {
count++
return true // 继续遍历
})