From 1a37d9670a491137cf3ef8ff281ceab8c83b492c Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 20 Mar 2024 21:32:27 +0800 Subject: [PATCH] 1 --- server/imserver_new/common/types.go | 21 +++++++++++++++++++++ server/imserver_new/player/playermgr.go | 22 ++-------------------- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/server/imserver_new/common/types.go b/server/imserver_new/common/types.go index a232261c..0cf12718 100644 --- a/server/imserver_new/common/types.go +++ b/server/imserver_new/common/types.go @@ -9,6 +9,27 @@ import ( proto "github.com/golang/protobuf/proto" ) +type HistorySeasons struct { + TotalKills int `json:"total_kills"` + WinTimes int `json:"win_times"` +} + +type LoginRsp struct { + Errcode int `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"` +} + type WspListener interface { ProcessSSMMsg(*ss.SsNetMsgHandler, *f5.MsgHdr) SendProxyMsg(net.Conn, uint16, proto.Message) diff --git a/server/imserver_new/player/playermgr.go b/server/imserver_new/player/playermgr.go index 18e7460e..aaf33c03 100644 --- a/server/imserver_new/player/playermgr.go +++ b/server/imserver_new/player/playermgr.go @@ -10,6 +10,7 @@ import ( "q5" //"net" "main/constant" + "main/common" . "main/global" ) @@ -72,27 +73,8 @@ func (this *playerMgr) CMLogin(hdr *f5.MsgHdr, msg *cs.CMLogin) { }) } -type HistorySeasons struct { - TotalKills int `json:"total_kills"` - WinTimes int `json:"win_times"` -} - func (this *playerMgr) apiAuthCb(hdr *f5.MsgHdr, msg *cs.CMLogin, rsp f5.HttpCliResponse) { - resObj := struct { - Errcode int `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"` - }{} + resObj := common.LoginRsp{} err := json.Unmarshal([]byte(rsp.GetRawData()), &resObj) if err != nil { f5.GetSysLog().Info("Api服务器JSON 解析错误:%s\n", err)