新增获取游戏全局配置接口
This commit is contained in:
		
							parent
							
								
									66eb586d88
								
							
						
					
					
						commit
						68a9435cb7
					
				@ -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
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -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)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -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{},
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user