refactor(socket): 优化消息处理逻辑,避免顺序执行问题 将消息处理的循环从协程外部移入协程内部,确保每个消息在独立的 goroutine 中处理, 避免因并发导致的消息顺序错乱问题。同时移除了多余的空行,使代码更简洁。 fix(controller): 为低 ID 用户设置 VIP 标志 在 COMMEND_ONLINE 接口逻辑中,新增对 UserID 小于 10000 的用户设置 IsVip = 1, 用于标识测试或特殊用户身份。 ref
25 lines
539 B
Go
25 lines
539 B
Go
package controller
|
|
|
|
import (
|
|
"blazing/common/socket/errorcode"
|
|
|
|
"blazing/logic/service/user"
|
|
|
|
"github.com/panjf2000/gnet/v2"
|
|
)
|
|
|
|
// 处理命令: 105
|
|
func (h *Controller) COMMEND_ONLINE(data *user.SidInfo, c gnet.Conn) (result *user.CommendSvrInfo, err errorcode.ErrorCode) { //这个时候player应该是空的
|
|
result = user.NewInInfo()
|
|
|
|
if data.Head.UserID < 100000 {
|
|
result.IsVip = 1
|
|
}
|
|
|
|
result.ServerList = user.GetServerInfoList()
|
|
|
|
return
|
|
|
|
//return //TODO 这里待实现改成接口调用Ret方法
|
|
}
|