7
0

封装game项目获取h5登录背景图方法

This commit is contained in:
huangqz 2025-10-15 16:28:48 +08:00
parent c2606d0a41
commit b3cb834ff2
3 changed files with 55 additions and 0 deletions

View File

@ -123,3 +123,10 @@ func (c *Client) KickUser(req *KickUserReq) (resp *KickUserResp, err error) {
err = c.DoAction(req, resp)
return
}
// GetLoginBg 获取登录背景图
func (c *Client) GetLoginBg(req *GetLoginBgReq) (resp *GetLoginBgResp, err error) {
resp = CreateGetLoginBgResp()
err = c.DoAction(req, resp)
return
}

View File

@ -227,3 +227,17 @@ func TestKickUser(t *testing.T) {
}
t.Log(kickUserResp)
}
// 测试获取h5登录背景图
func TestGetLoginBg(t *testing.T) {
client, err := NewClient()
if err != nil {
t.Error(err)
}
getLoginBgResp, err := client.GetLoginBg(CreateGetLoginBgReq(6086))
if err != nil {
t.Error(err)
return
}
t.Log(getLoginBgResp)
}

View File

@ -488,3 +488,37 @@ func CreateKickUserResp() *KickUserResp {
BaseResponse: &responses.BaseResponse{},
}
}
// GetLoginBgReq
// h5登录背景图
type GetLoginBgReq struct {
*requests.RpcRequest
GameId int64 `position:"Body" field:"game_id" default:"-" `
}
type GetLoginBgRespData struct {
LoginBg string `json:"login_bg"`
}
type GetLoginBgResp struct {
*responses.BaseResponse
Code int `json:"code"`
Msg string `json:"msg"`
Data GetLoginBgRespData `json:"data"`
}
func CreateGetLoginBgReq(gameId int64) *GetLoginBgReq {
req := &GetLoginBgReq{
RpcRequest: &requests.RpcRequest{},
GameId: gameId,
}
req.InitWithApiInfo(HOST, VERSION, "/api/game/getLoginBg")
req.Method = requests.POST
return req
}
func CreateGetLoginBgResp() *GetLoginBgResp {
return &GetLoginBgResp{
BaseResponse: &responses.BaseResponse{},
}
}