新增获取游戏系统信息接口
This commit is contained in:
parent
675a48f7d1
commit
995293926f
31
services/game/client.go
Normal file
31
services/game/client.go
Normal 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
|
||||
}
|
22
services/game/client_test.go
Normal file
22
services/game/client_test.go
Normal 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
49
services/game/game.go
Normal 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{},
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user