diff --git a/server/matchserver/common/types.go b/server/matchserver/common/types.go index d58fbef0..ea48595d 100644 --- a/server/matchserver/common/types.go +++ b/server/matchserver/common/types.go @@ -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"` } diff --git a/server/matchserver/player/player.go b/server/matchserver/player/player.go index 22a9710b..a46cf836 100644 --- a/server/matchserver/player/player.go +++ b/server/matchserver/player/player.go @@ -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, diff --git a/server/matchserver/player/playermgr.go b/server/matchserver/player/playermgr.go index 169a6c05..b869c0b3 100644 --- a/server/matchserver/player/playermgr.go +++ b/server/matchserver/player/playermgr.go @@ -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")