From a82061d592e48283b9580926dfa0909eb71f9551 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B6=E8=8C=82=E6=96=B0?= Date: Fri, 16 Jan 2026 12:06:42 +0800 Subject: [PATCH] =?UTF-8?q?pay:=E6=96=B0=E5=A2=9E=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E4=BB=A3=E9=87=91=E5=88=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/pay/client.go | 8 +++++ services/pay/get_user_voucher.go | 51 ++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 services/pay/get_user_voucher.go 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 +}