From 68a9435cb7a99b7f294ee17d0f2fa8fe9d782193 Mon Sep 17 00:00:00 2001 From: huangqz Date: Thu, 10 Jul 2025 11:42:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=8E=B7=E5=8F=96=E6=B8=B8?= =?UTF-8?q?=E6=88=8F=E5=85=A8=E5=B1=80=E9=85=8D=E7=BD=AE=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 | 7 +++++++ services/game/client_test.go | 15 +++++++++++++++ services/game/game.go | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+) diff --git a/services/game/client.go b/services/game/client.go index b61f964..e701776 100644 --- a/services/game/client.go +++ b/services/game/client.go @@ -88,3 +88,10 @@ func (c *Client) GetGameVersion(req *GetGameVersionReq) (resp *GetGameVersionRes err = c.DoAction(req, resp) return } + +// GetConfig 获取游戏全局配置 +func (c *Client) GetConfig(req *GetConfigReq) (resp *GetConfigResp, err error) { + resp = CreateGetConfigResp() + err = c.DoAction(req, resp) + return +} diff --git a/services/game/client_test.go b/services/game/client_test.go index 8b71299..7f2ff9d 100644 --- a/services/game/client_test.go +++ b/services/game/client_test.go @@ -134,3 +134,18 @@ func TestIsBlockOutIos(t *testing.T) { } t.Log(isBlockOutIos) } + +// 获取游戏全局配置 +func TestGetConfig(t *testing.T) { + client, err := NewClient() + if err != nil { + t.Error(err) + } + getConfigReq := CreateGetConfigReq("overlord_act_config") + isBlockOutIos, err := client.GetConfig(getConfigReq) + if err != nil { + t.Error(err) + return + } + t.Log(isBlockOutIos) +} diff --git a/services/game/game.go b/services/game/game.go index 6d42791..e8ba4f1 100644 --- a/services/game/game.go +++ b/services/game/game.go @@ -315,3 +315,38 @@ func CreateGetGameVersionResp() *GetGameVersionResp { BaseResponse: &responses.BaseResponse{}, } } + +// GetConfigReq +// 游戏全局配置 +type GetConfigReq struct { + *requests.RpcRequest + Key string `position:"Query" field:"key" default:"-" ` +} + +type GetConfigRespData struct { + Id int `json:"id"` + Key string `json:"key"` + ExtData string `json:"ext_data"` +} +type GetConfigResp struct { + *responses.BaseResponse + Code int `json:"code"` + Msg string `json:"msg"` + Data GetConfigRespData `json:"data"` +} + +func CreateGetConfigReq(key string) *GetConfigReq { + req := &GetConfigReq{ + RpcRequest: &requests.RpcRequest{}, + } + req.Key = key + req.InitWithApiInfo(HOST, VERSION, "/api/game/getConfig") + req.Method = requests.GET + return req +} + +func CreateGetConfigResp() *GetConfigResp { + return &GetConfigResp{ + BaseResponse: &responses.BaseResponse{}, + } +}