game/test/client/server/login.go

28 lines
617 B
Go
Raw Normal View History

2025-05-29 20:47:59 +08:00
package server
import (
"game/common/proto/pb"
"github.com/fox/fox/log"
)
func (s *ClientService) login() {
s.SendMsg(pb.ServiceTypeId_STI_Login, int32(pb.MsgId_C2SUserLoginId), &pb.C2SUserLogin{
Username: s.username,
Password: s.password,
Ip: "",
DeviceId: "",
Version: "",
})
}
// 收到登陆成功消息,判断是否顶号
func (s *ClientService) onLogin(cMsg *pb.ClientMsg, msg *pb.S2CUserLogin) {
if msg.Code != pb.ErrCode_OK {
log.ErrorF("login error: %v", msg.Code)
return
}
_ = cMsg
s.userId = msg.UserId
log.DebugF("user:%v id:%v login success", s.username, msg.UserId)
}