diff --git a/services/pay/client.go b/services/pay/client.go index 30e0f0c..6108c8f 100644 --- a/services/pay/client.go +++ b/services/pay/client.go @@ -86,3 +86,11 @@ func (c *Client) GetUserPay(req *GetUserPayRequest) (response *GetUserPayRespons err = c.DoAction(req, response) return } + +// GetUserVoucher +// 获取用户代金券 +func (c *Client) GetUserVoucher(req *GetUserVoucherRequest) (response *GetUserVoucherResponse, err error) { + response = CreateGetUserVoucherResponse() + err = c.DoAction(req, response) + return +} diff --git a/services/pay/get_user_voucher.go b/services/pay/get_user_voucher.go new file mode 100644 index 0000000..f9cc84c --- /dev/null +++ b/services/pay/get_user_voucher.go @@ -0,0 +1,51 @@ +package pay + +import ( + "golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/requests" + "golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/responses" +) + +type GetUserVoucherRequest struct { + *requests.RpcRequest + UserName string `position:"Body" field:"user_name"` + PayMoney float64 `position:"Body" field:"pay_money"` + GameId int64 `position:"Body" field:"game_id" ` +} + +type GetUserVoucherResponse struct { + *responses.BaseResponse + Code int `json:"code"` + Msg string `json:"msg"` + Data struct { + List []Voucher `json:"list"` + } `json:"data"` +} + +type Voucher struct { + Code string `json:"code"` + Threshold float64 `json:"threshold"` + Discount float64 `json:"discount"` + Type int `json:"type"` + Status int `json:"status"` + Number int `json:"number"` + Deadline string `json:"deadline"` +} + +func CreateGetUserVoucherRequest(userName string, gameId int64, payMoney float64) (req *GetUserVoucherRequest) { + req = &GetUserVoucherRequest{ + RpcRequest: &requests.RpcRequest{}, + UserName: userName, + GameId: gameId, + PayMoney: payMoney, + } + req.InitWithApiInfo(HOST, VERSION, "/api/user/getUserVoucher") + req.Method = requests.POST + return +} + +func CreateGetUserVoucherResponse() (response *GetUserVoucherResponse) { + response = &GetUserVoucherResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +}