diff --git a/services/game/client.go b/services/game/client.go index f0d1a2c..23327eb 100644 --- a/services/game/client.go +++ b/services/game/client.go @@ -6,7 +6,7 @@ import ( ) const ( - VERSION = "2025-04-27" + VERSION = "2025-05-28" ) var HOST = requests.Host{ @@ -54,3 +54,8 @@ func (c *Client) GetProtocolByGameId(req *GetProtocolByGameIdRep) (resp *GetProt err = c.DoAction(req, resp) return } +func (c *Client) GetGameSimpleList(req *GetGameSimpleListReq) (resp *GetGameSimpleListResp, err error) { + resp = CreateGetGameSimpleListResp() + err = c.DoAction(req, resp) + return +} diff --git a/services/game/client_test.go b/services/game/client_test.go index e872aa1..b470a01 100644 --- a/services/game/client_test.go +++ b/services/game/client_test.go @@ -77,3 +77,17 @@ func TestGetProtocolByGameId(t *testing.T) { } fmt.Println(info) } + +func TestGetGameSimpleList(t *testing.T) { + client, err := NewClient() + if err != nil { + panic(err) + } + req := CreateGetGameSimpleListReq("8071,8062", "") + info, err := client.GetGameSimpleList(req) + if err != nil { + t.Error(err) + return + } + fmt.Println(info) +} diff --git a/services/game/game.go b/services/game/game.go index 48ac841..99683fe 100644 --- a/services/game/game.go +++ b/services/game/game.go @@ -162,3 +162,47 @@ func CreateGetGameInfoByIdResp() *GetGameInfoResp { BaseResponse: &responses.BaseResponse{}, } } + +type GetGameSimpleListReq struct { + *requests.RpcRequest +} + +type GetGameSimpleListResp struct { + *responses.BaseResponse + Code int `json:"code"` + Msg string `json:"msg"` + Data map[string]GameSimple `json:"data"` +} + +type GameSimple struct { + ID int `json:"id"` + Name string `json:"name"` + GameSign string `json:"game_sign"` +} + +// CreateGetGameSimpleListReq +// gids 子游戏字符串,多个子游戏id用英文逗号分割 +// game_signs 根游戏标识字符串,多个标识用英文逗号分割 +func CreateGetGameSimpleListReq(gameIds string, gameSigns string) *GetGameSimpleListReq { + req := &GetGameSimpleListReq{ + RpcRequest: &requests.RpcRequest{}, + } + req.InitWithApiInfo(HOST, VERSION, "/api/game/getSimpleList") + tmpParams := make(map[string]string) + if gameIds != "" { + tmpParams["gids"] = gameIds + } + if gameSigns != "" { + tmpParams["game_signs"] = gameSigns + } + req.FormParams = tmpParams + + req.Method = requests.POST + return req +} + +func CreateGetGameSimpleListResp() *GetGameSimpleListResp { + return &GetGameSimpleListResp{ + BaseResponse: &responses.BaseResponse{}, + } +}