1
This commit is contained in:
parent
b2ebe43b70
commit
f4da177f3c
@ -162,6 +162,7 @@ func (this *playerMgr) apiAuthCb(hdr *f5.MsgHdr, msg *cs.CMLogin, rsp f5.HttpCli
|
||||
hum.init(pendingReq, &rspObj)
|
||||
this.accountIdHash[hum.GetAccountId()] = hum
|
||||
this.socketHash[pendingReq.hdr.GetSocket()] = hum
|
||||
rspMsg.AccountId = proto.String(rspObj.Info.AccountID)
|
||||
rspMsg.ServerInfo = proto.String(mt.Table.IMCluster.GetServerInfo())
|
||||
GetWspListener().SendProxyMsg(hdr.Conn, hdr.SocketHandle, &rspMsg)
|
||||
/*
|
||||
@ -187,14 +188,6 @@ func (this *playerMgr) apiAuthCb(hdr *f5.MsgHdr, msg *cs.CMLogin, rsp f5.HttpCli
|
||||
version := cacheMgr.getCacheVersion()
|
||||
cacheMgr.AddPlayerProfile(version, playerProfile)
|
||||
friendMgr.LoadUser(accountId)
|
||||
|
||||
serverInfo := proto.String(mt.Table.IMCluster.GetServerInfo())
|
||||
f5.GetSysLog().Info("ServerInfo:%s", *serverInfo)
|
||||
|
||||
rspMsg := &cs.SMLogin{}
|
||||
rspMsg.ServerInfo = serverInfo
|
||||
rspMsg.AccountId = &resObj.Info.AccountID
|
||||
GetWspListener().SendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
*/
|
||||
}
|
||||
|
||||
@ -232,16 +225,13 @@ func (this *playerMgr) genSeqId() int64 {
|
||||
return reqId
|
||||
}
|
||||
|
||||
func (this *playerMgr) GetPlayers() map[string]*player {
|
||||
return this.accountIdHash
|
||||
}
|
||||
|
||||
func (this *playerMgr) GetPlayerByAccountId(accountId string) *player {
|
||||
player, ok := this.accountIdHash[accountId]
|
||||
if ok {
|
||||
return player
|
||||
func (this *playerMgr) GetPlayerByAccountId(accountId string) common.Player {
|
||||
hum := this.internalGetPlayerByAccountId(accountId)
|
||||
if hum != nil {
|
||||
return hum
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (this *playerMgr) internalGetPlayerByAccountId(accountId string) *player {
|
||||
@ -268,16 +258,8 @@ func (this *playerMgr) getPlayerBySocket(socket f5.WspCliConn) *player {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (this *playerMgr) GetOnlineStatus(accountId string) int32 {
|
||||
player := this.GetPlayerByAccountId(accountId)
|
||||
if player != nil {
|
||||
return constant.OnlineStatus
|
||||
}
|
||||
return constant.OnlineStatusOff
|
||||
}
|
||||
|
||||
func (this *playerMgr) CMReconnect(hdr *f5.MsgHdr, msg *cs.CMReconnect) {
|
||||
hum := this.GetPlayerByAccountId(msg.GetAccountId())
|
||||
hum := this.internalGetPlayerByAccountId(msg.GetAccountId())
|
||||
rspMsg := &cs.SMReconnect{}
|
||||
if hum == nil {
|
||||
rspMsg.Errcode = proto.Int32(constant.ERR_CODE_RECONNECT_PLAYER_NO_EXISTS)
|
||||
@ -294,67 +276,3 @@ func (this *playerMgr) CMReconnect(hdr *f5.MsgHdr, msg *cs.CMReconnect) {
|
||||
hum.reBind(hdr.GetSocket())
|
||||
GetWspListener().SendProxyMsg(hdr.Conn, hdr.SocketHandle, rspMsg)
|
||||
}
|
||||
|
||||
// GetRemotePlayerInfo
|
||||
/*
|
||||
func (this *playerMgr) GetRemotePlayerInfo(player *player, cb func(errCode int32, errMsg string, p *playerProfile)) {
|
||||
params := map[string]string{
|
||||
"c": "User",
|
||||
"a": "detailInfo",
|
||||
"account_id": player.GetAccountId(),
|
||||
"session_id": player.GetSessionId(),
|
||||
"target_id": player.GetAccountId(),
|
||||
}
|
||||
url := fmt.Sprintf("%s/webapp/index.php", mt.Table.Config.GetById(0).GetGameapiUrl())
|
||||
f5.GetSysLog().Info("GetPlayerInfo url:%s, params:%+v\n", url, params)
|
||||
f5.GetHttpCliMgr().SendJsStyleRequest(
|
||||
url,
|
||||
params,
|
||||
func(rsp f5.HttpCliResponse) {
|
||||
resObj := struct {
|
||||
ErrCode int32 `json:"errcode"`
|
||||
ErrMsg string `json:"errmsg"`
|
||||
Info struct {
|
||||
Activated string `json:"activated"`
|
||||
AccountId string `json:"account_id"`
|
||||
Name string `json:"name"`
|
||||
Avatar string `json:"head_id"`
|
||||
AvatarHead string `json:"head_frame"`
|
||||
Star string `json:"current_star_num"`
|
||||
Rank string `json:"current_rank"`
|
||||
LastLoginTime string `json:"last_login_time"`
|
||||
HistorySeasons []HistorySeasons `json:"history_seasons"`
|
||||
} `json:"info"`
|
||||
}{}
|
||||
err := json.Unmarshal([]byte(rsp.GetRawData()), &resObj)
|
||||
if err != nil {
|
||||
cb(constant.ERR_CODE_GUILD_API_ERROR, "SetNameConsume Api服务器JSON解析错误", nil)
|
||||
f5.GetSysLog().Info("SetNameConsume Api服务器JSON解析错误:%s\n", err)
|
||||
return
|
||||
}
|
||||
if resObj.ErrCode != 0 {
|
||||
cb(resObj.ErrCode, "Api服务器errcode", nil)
|
||||
f5.GetSysLog().Error("Api服务器errcode:%d", resObj.ErrCode)
|
||||
return
|
||||
}
|
||||
playerProfile := &PlayerProfile{
|
||||
AccountId: resObj.Info.AccountId,
|
||||
Username: resObj.Info.Name,
|
||||
Avatar: q5.ToInt32(resObj.Info.Avatar),
|
||||
AvatarHead: q5.ToInt32(resObj.Info.AvatarHead),
|
||||
Star: q5.ToInt32(resObj.Info.Star),
|
||||
Rank: q5.ToInt32(resObj.Info.Rank),
|
||||
OnlineStatus: this.GetOnlineStatus(resObj.Info.AccountId),
|
||||
LastLoginTime: q5.ToInt32(resObj.Info.LastLoginTime),
|
||||
}
|
||||
if len(resObj.Info.HistorySeasons) == 1 {
|
||||
playerProfile.TotalKills = q5.ToInt32(resObj.Info.HistorySeasons[0].TotalKills)
|
||||
playerProfile.TotalWinTimes = q5.ToInt32(resObj.Info.HistorySeasons[0].WinTimes)
|
||||
} else {
|
||||
playerProfile.TotalKills = 0
|
||||
playerProfile.TotalWinTimes = 0
|
||||
}
|
||||
cb(resObj.ErrCode, resObj.ErrMsg, playerProfile)
|
||||
})
|
||||
}
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user