refactor(login): 重构登录模块代码
- 移除未使用的 in.go 和 out.go 文件 - 优化 login.go 中的代码结构 - 添加新的 go.mod 依赖
This commit is contained in:
41
logic/service/login/CommendSvrInfo.go
Normal file
41
logic/service/login/CommendSvrInfo.go
Normal file
@@ -0,0 +1,41 @@
|
||||
package login
|
||||
|
||||
// CommendSvrInfo 初始连接请求信息结构体
|
||||
type CommendSvrInfo struct {
|
||||
//Handler handler.TomeeHeader //` struc:"[0]pad"` //消息头 ,这里为传入的头部数据,遍历此头部实现解析CommendSvrInfo
|
||||
MaxOnlineID uint32 // 最大连接数
|
||||
IsVip uint32 // 建议为0
|
||||
ServerInfoLen uint32 `struc:"sizeof=ServerList"` // 服务器信息长度 ServerInfo
|
||||
ServerList []ServerInfo // 服务器具体信息
|
||||
Reversed uint32 // 保留字段
|
||||
}
|
||||
|
||||
func NewCommendSvrInfo() *CommendSvrInfo {
|
||||
return &CommendSvrInfo{
|
||||
// Handler: handler.TomeeHeader{},
|
||||
MaxOnlineID: 100,
|
||||
IsVip: 0,
|
||||
ServerInfoLen: 0,
|
||||
ServerList: make([]ServerInfo, 0),
|
||||
Reversed: 0,
|
||||
}
|
||||
}
|
||||
|
||||
// ServerInfo 服务器信息结构体
|
||||
type ServerInfo struct {
|
||||
// 连接ID, 即服务器序号
|
||||
OnlineID uint32
|
||||
// 当前服务器玩家在线数量, 供SWF显示
|
||||
UserCnt uint32
|
||||
// 服务器IP, 16字节UTF-8, 不足16补齐到16
|
||||
IP string `struc:"[16]byte"` // 定长模式:16字节
|
||||
// 端口
|
||||
Port uint16
|
||||
// 好友在线的个数
|
||||
Friends uint32
|
||||
}
|
||||
|
||||
// NewServerInfo 创建新的服务器信息实例
|
||||
func NewServerInfo() *ServerInfo {
|
||||
return &ServerInfo{}
|
||||
}
|
||||
Reference in New Issue
Block a user