refactor(socket): 重构 ClientData 结构体并优化相关逻辑
- 简化 ClientData 结构体,移除不必要的方法 - 优化 Player 结构体,调整 Conn 类型 - 更新 wscodec.go 中的 Conn 结构体 - 删除未使用的 XML 相关文件和代码 - 调整 ServerEvent 和 controller 中的相关逻辑
This commit is contained in:
@@ -88,7 +88,7 @@ func init() { //默认初始化扫描
|
||||
method := typ.Method(i)
|
||||
|
||||
methodValue := value.MethodByName(method.Name)
|
||||
fmt.Println("找到注册方法", method.Name)
|
||||
//fmt.Println("找到注册方法", method.Name)
|
||||
methodValue.Type().NumIn()
|
||||
|
||||
for _, func_cmd := range getcmd(methodValue.Type().In(0)) {
|
||||
@@ -190,13 +190,14 @@ func Recv(c *socket.Conn, data handler.TomeeHeader) {
|
||||
nameField.Set(reflect.ValueOf(data))
|
||||
}
|
||||
if cmdlister.Type().In(1) == reflect.TypeOf(&socket.Player{}) {
|
||||
c1 := service.GetPlayer(c, data.UserID)
|
||||
err := c1.WaitForLoginWithCtx(context.Background())
|
||||
t := service.GetPlayer(c, data.UserID)
|
||||
// fmt.Println(data.CMD, "接收 变量的地址 ", &t.Info, t.Info.UserID)
|
||||
err := t.WaitForLoginWithCtx(context.Background())
|
||||
if err != nil {
|
||||
fmt.Println("登录失败")
|
||||
}
|
||||
|
||||
params = append(params, ptrValue1, reflect.ValueOf(c1))
|
||||
params = append(params, ptrValue1, reflect.ValueOf(t))
|
||||
} else {
|
||||
|
||||
params = append(params, ptrValue1, reflect.ValueOf(c))
|
||||
@@ -225,7 +226,7 @@ func Recv(c *socket.Conn, data handler.TomeeHeader) {
|
||||
}
|
||||
|
||||
data.Version = "7"
|
||||
glog.Debug(context.Background(), data.CMD, "回复数据")
|
||||
//glog.Debug(context.Background(), data.CMD, "回复数据")
|
||||
c.SendPack(data.Pack(ret[0].Interface()))
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user