7
0

Compare commits

...

1 Commits

Author SHA1 Message Date
995293926f 新增获取游戏系统信息接口 2024-09-12 14:27:03 +08:00
3 changed files with 102 additions and 0 deletions

31
services/game/client.go Normal file
View File

@ -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
}

View File

@ -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)
}

49
services/game/game.go Normal file
View File

@ -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{},
}
}