diff --git a/services/game/client.go b/services/game/client.go new file mode 100644 index 0000000..635d31f --- /dev/null +++ b/services/game/client.go @@ -0,0 +1,31 @@ +package game + +import ( + "golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk" + "golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" +) + +const ( + VERSION = "2020-11-16" +) + +var HOST = requests.Host{ + Default: "game", +} + +type Client struct { + sdk.Client +} + +func NewClient() (client *Client, err error) { + client = new(Client) + err = client.Init() + return +} + +// GetGameOsInfo 获取游戏系统信息 +func (c *Client) GetGameOsInfo(req *GetGameOsInfoReq) (resp *GetGameOsInfoResp, err error) { + resp = CreateGetGameOsInfoResp() + err = c.DoAction(req, resp) + return +} diff --git a/services/game/client_test.go b/services/game/client_test.go new file mode 100644 index 0000000..58a6d37 --- /dev/null +++ b/services/game/client_test.go @@ -0,0 +1,22 @@ +package game + +import ( + "fmt" + "testing" +) + +func TestGetGameOsInfo(t *testing.T) { + client, err := NewClient() + if err != nil { + panic(err) + } + + req := CreateGetGameOsInfoReq() + + resp, err := client.GetGameOsInfo(req) + if err != nil { + panic(err) + } + + fmt.Println(resp.Code, resp.Msg, resp.Data.OsList, resp.Data.OsRelList2) +} diff --git a/services/game/game.go b/services/game/game.go new file mode 100644 index 0000000..51e65dd --- /dev/null +++ b/services/game/game.go @@ -0,0 +1,49 @@ +package game + +import ( + "golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" + "golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses" +) + +type GetGameOsInfoReq struct { + *requests.RpcRequest +} + +type GetGameOsInfoResp struct { + *responses.BaseResponse + Code int `json:"code"` + Msg string `json:"msg"` + Data Data `json:"data"` +} + +type Data struct { + OsRelList2 []OsRelList2 `json:"os_rel_list2"` + OsList map[string]OsList `json:"os_list"` +} + +type OsRelList2 struct { + TwPlatID int `json:"tw_plat_id"` + TwOs int `json:"tw_os"` + Os int `json:"os"` + OsTwo int `json:"os_two"` +} + +type OsList struct { + Name string `json:"name"` + OsTwo map[string]interface{} +} + +func CreateGetGameOsInfoReq() *GetGameOsInfoReq { + req := &GetGameOsInfoReq{ + RpcRequest: &requests.RpcRequest{}, + } + req.InitWithApiInfo(HOST, VERSION, "/api/game/getGameOsInfo") + req.Method = requests.POST + return req +} + +func CreateGetGameOsInfoResp() *GetGameOsInfoResp { + return &GetGameOsInfoResp{ + BaseResponse: &responses.BaseResponse{}, + } +}