From 791e916418f389ae6c2940c7b78e1585d9f9c23b Mon Sep 17 00:00:00 2001 From: huangqz Date: Wed, 17 Dec 2025 16:55:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Egame=20getGameClientInfo?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/game/client.go | 9 ++++++++ services/game/client_test.go | 14 +++++++++++ services/game/game_client.go | 45 ++++++++++++++++++++++++++++++++++++ 3 files changed, 68 insertions(+) create mode 100644 services/game/game_client.go diff --git a/services/game/client.go b/services/game/client.go index 6e148c6..387cc77 100644 --- a/services/game/client.go +++ b/services/game/client.go @@ -138,3 +138,12 @@ func (c *Client) GetLabelListByCate(req *GetLabelListByCateRep) (response *GetLa err = c.DoAction(req, response) return } + +// GetGameClientInfo +// 获取游戏版本信息 +func (c *Client) GetGameClientInfo(gameId, status int64) (response *ClientInfoResp, err error) { + clientInfoReq := CreateClientInfoReq(status, gameId) + response = CreateClientInfoResp() + err = c.DoAction(clientInfoReq, response) + return +} diff --git a/services/game/client_test.go b/services/game/client_test.go index 9120e49..9ecedcd 100644 --- a/services/game/client_test.go +++ b/services/game/client_test.go @@ -241,3 +241,17 @@ func TestGetLoginBg(t *testing.T) { } t.Log(getLoginBgResp) } + +func TestGetGameClientInfo(t *testing.T) { + client, err := NewClient() + if err != nil { + t.Log(err) + return + } + resp, err := client.GetGameClientInfo(8961, 4) + if err != nil { + t.Log(err) + return + } + _ = resp +} diff --git a/services/game/game_client.go b/services/game/game_client.go new file mode 100644 index 0000000..0211602 --- /dev/null +++ b/services/game/game_client.go @@ -0,0 +1,45 @@ +package game + +import ( + "fmt" + "golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" + "golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses" +) + +type ClientInfoReq struct { + *requests.RpcRequest +} + +type ClientInfoResp struct { + *responses.BaseResponse + Code int `json:"code"` + Msg string `json:"msg"` + Data []ClientInfoDataItem `json:"data"` +} + +type ClientInfoDataItem struct { + Id int `json:"id"` + GameName string `json:"game_name"` + Status int `json:"status"` + Version string `json:"version"` + GameId int `json:"game_id"` + RequestDomain string `json:"request_domain"` + SpareRequestDomain string `json:"spare_request_domain"` + OtherRequestDomain string `json:"other_request_domain"` +} + +func CreateClientInfoReq(status, gameId int64) *ClientInfoReq { + req := &ClientInfoReq{ + &requests.RpcRequest{}, + } + + req.InitWithApiInfo(HOST, VERSION, fmt.Sprintf("/api/game/getGameClientInfo?game_id=%d&status=%d", gameId, status)) + req.Method = requests.GET + return req +} + +func CreateClientInfoResp() *ClientInfoResp { + return &ClientInfoResp{ + BaseResponse: &responses.BaseResponse{}, + } +}