This commit is contained in:
aozhiwei 2024-04-18 19:45:01 +08:00
parent 87f00fba17
commit a785ee38c1
3 changed files with 32 additions and 3 deletions

View File

@ -33,7 +33,7 @@ type LoginRsp struct {
Wealth interface{} `json:"wealth"`
ValidLefttime interface{} `json:"valid_lefttime"`
} `json:"hero_info"`
MapInfo MapInfoRsp `json:"map_info"`
MapInfo *MapInfoRsp `json:"map_info"`
} `json:"info"`
}

View File

@ -392,7 +392,36 @@ func (this *player) CMChooseMap(hdr *f5.MsgHdr, msg *cs.CMChooseMap) {
func (this *player) CMRefreshUser(hdr *f5.MsgHdr, msg *cs.CMRefreshUser) {
rspMsg := new(cs.SMRefreshUser)
this.SendMsg(rspMsg)
params := map[string]string{
"c": "User",
"a": "getBattleUser",
"account_id": this.GetAccountId(),
"session_id": this.GetSessionId(),
}
rspObj := common.LoginRsp{}
url := fmt.Sprintf("%s/webapp/index.php", mt.Table.Config.GetById(0).GetGameapiUrl())
f5.GetHttpCliMgr().SendJsStyleJsonRspRequest(
url,
params,
rspObj,
func(rsp f5.HttpCliResponse) {
this.SendMsg(rspMsg)
if rsp.GetErr() == nil && rsp.JsonParseOk() {
this.name = rspObj.Info.UserInfo.Name
this.avatarUrl = rspObj.Info.UserInfo.HeadId
this.headFrame = rspObj.Info.UserInfo.HeadFrame
q5.DuckToSimple(rspObj.Info.UserInfo.AdmissionItemNum, &this.admissionItemNum)
q5.DuckToSimple(rspObj.Info.UserInfo.TotalLucky, &this.totalLucky)
{
this.hero.heroUniId = rspObj.Info.HeroInfo.HeroUniId
this.hero.heroId = q5.ToInt32(rspObj.Info.HeroInfo.HeroId)
this.hero.quality = q5.ToInt32(rspObj.Info.HeroInfo.Quality)
this.hero.specSkill = q5.ToInt32(rspObj.Info.HeroInfo.SpecSkill)
q5.DuckToSimple(rspObj.Info.HeroInfo.Wealth, &this.hero.wealth)
q5.DuckToSimple(rspObj.Info.HeroInfo.ValidLefttime, &this.hero.validLeftTime)
}
}
})
}
func (this *player) updateChoose(skillId int32, heroUniId string,

View File

@ -181,7 +181,7 @@ func (this *playerMgr) apiAuthCb(hdr *f5.MsgHdr, msg *cs.CMLogin, rsp f5.HttpCli
hum := newPlayer()
hum.init(pendingReq, &rspObj)
this.socketHash[pendingReq.hdr.GetSocket()] = hum
team := GetTeamMgr().CreateTeam(hum, msg, &rspObj.Info.MapInfo)
team := GetTeamMgr().CreateTeam(hum, msg, rspObj.Info.MapInfo)
if team == nil {
rspMsg.Errcode = proto.Int32(102)
rspMsg.Errmsg = proto.String("create team error")