From dcf2057a86584cbe13d42e21115ee628dbd9dce4 Mon Sep 17 00:00:00 2001 From: lwl0608 Date: Thu, 30 May 2024 11:09:59 +0800 Subject: [PATCH] redirect url --- api/proto/vas/proto/pay.go | 2 ++ api/proto/vas/proto/vas.go | 1 + app/mix/service/logic/vas.go | 3 +++ app/mix/service/logic/vas_zone.go | 1 + library/payclients/yeepaycli/client.go | 3 +++ 5 files changed, 10 insertions(+) diff --git a/api/proto/vas/proto/pay.go b/api/proto/vas/proto/pay.go index 08e0f153..19519f26 100644 --- a/api/proto/vas/proto/pay.go +++ b/api/proto/vas/proto/pay.go @@ -56,6 +56,7 @@ type CreateOrderReq struct { Operator string `json:"operator"` // 操作人 CustomCoins int64 `json:"custom_coins"` // 自定义金币数,product_id:"h5_custom_coin" WechatAuthCode string `json:"wechat_auth_code"` // 微信auth_code + RedirectUrl string `json:"redirect_url"` // redirect_url CalcPrice int64 // 计算价格 Uid int64 // 关联mid @@ -149,6 +150,7 @@ type H5DirectUnlockWechatReq struct { Uid int64 `json:"uid"` // 主播id PayType string `json:"pay_type"` // 支付类型 WechatAuthCode string `json:"wechat_auth_code"` // 微信auth_code + RedirectUrl string `json:"redirect_url"` // redirect_url } type H5DirectUnlockWechatData struct { diff --git a/api/proto/vas/proto/vas.go b/api/proto/vas/proto/vas.go index 4333ed68..18498679 100644 --- a/api/proto/vas/proto/vas.go +++ b/api/proto/vas/proto/vas.go @@ -159,6 +159,7 @@ type ZoneCreateOrderReq struct { PayType string `json:"pay_type"` // 支付方式 From string `json:"from"` // 来源 WechatAuthCode string `json:"wechat_auth_code"` // 微信auth_code + RedirectUrl string `json:"redirect_url"` // redirect_url } type ZoneCreateOrderData struct { diff --git a/app/mix/service/logic/vas.go b/app/mix/service/logic/vas.go index ed2fbc0d..2ce3d4f3 100644 --- a/app/mix/service/logic/vas.go +++ b/app/mix/service/logic/vas.go @@ -306,6 +306,7 @@ func (v *Vas) CreateOrder(ctx *gin.Context, req *vasproto.CreateOrderReq) (data Description: product.Subject, OutTradeNo: orderId, TotalAmount: product.RealPrice, + RedirectUrl: req.RedirectUrl, PayWay: yeepaycli.YeepayWayH5, PayChannel: yeepaycli.YeepayChannelAlipay, Ip: ctx.ClientIP(), @@ -328,6 +329,7 @@ func (v *Vas) CreateOrder(ctx *gin.Context, req *vasproto.CreateOrderReq) (data Description: product.Subject, OutTradeNo: orderId, TotalAmount: product.RealPrice, + RedirectUrl: req.RedirectUrl, PayWay: yeepaycli.YeepayWayH5, PayChannel: yeepaycli.YeepayChannelWxpay, Ip: ctx.ClientIP(), @@ -1156,6 +1158,7 @@ func (v *Vas) H5DirectUnlockWechat(ctx *gin.Context, req *vasproto.H5DirectUnloc CalcPrice: uVas.GetH5WechatCoinPrice() * 10, Uid: uid, ReturnUrl: "https://tiefen.fun/purchased", + RedirectUrl: req.RedirectUrl, }) if err != nil { logger.Error("CreateOrder fail, req: %v, err: %v", util.ToJson(req), err) diff --git a/app/mix/service/logic/vas_zone.go b/app/mix/service/logic/vas_zone.go index 7d78eaf3..3b7f9c31 100644 --- a/app/mix/service/logic/vas_zone.go +++ b/app/mix/service/logic/vas_zone.go @@ -252,6 +252,7 @@ func (v *Vas) ZoneCreateOrder(ctx *gin.Context, req *vasproto.ZoneCreateOrderReq Uid: uid, Oid1: fmt.Sprintf("%d", req.Zid), Oid2: oid2, + RedirectUrl: req.RedirectUrl, } createOrderData, err := v.CreateOrder(ctx, createOrderReq) if err != nil { diff --git a/library/payclients/yeepaycli/client.go b/library/payclients/yeepaycli/client.go index 85305841..587686b7 100644 --- a/library/payclients/yeepaycli/client.go +++ b/library/payclients/yeepaycli/client.go @@ -139,6 +139,9 @@ func (c *YeepayClient) AggPay(ctx context.Context, param *AggPayParam) (resp *Ag req.AddParam("channel", param.PayChannel) req.AddParam("scene", "OFFLINE") req.AddParam("userIp", param.Ip) + if len(param.RedirectUrl) > 0 { + req.AddParam("redirectUrl", param.RedirectUrl) + } respMeta, err := c.client.Request(req) if err != nil {