diff --git a/internal/model/web/alipay.go b/internal/model/web/alipay.go index 803a66fd..4d6d6586 100644 --- a/internal/model/web/alipay.go +++ b/internal/model/web/alipay.go @@ -27,8 +27,9 @@ type UserWalletBillsResp base.PageResp type UserRechargeLinkReq struct { BaseInfo `json:"-" form:"-" binding:"-"` - Host string `json:"-" form:"-" binding:"-"` - Amount int64 `json:"amount" form:"amount" binding:"required"` + Ctx context.Context `json:"-" form:"-" binding:"-"` + Host string `json:"-" form:"-" binding:"-"` + Amount int64 `json:"amount" form:"amount" binding:"required"` } type UserRechargeLinkResp struct { @@ -82,6 +83,7 @@ func (r *UserWalletBillsReq) Bind(c *gin.Context) error { func (r *UserRechargeLinkReq) Bind(c *gin.Context) error { r.Host = c.Request.Host + r.Ctx = c.Request.Context() return bindAny(c, r) } diff --git a/internal/servants/web/alipay.go b/internal/servants/web/alipay.go index 3734d2d9..d88eafbc 100644 --- a/internal/servants/web/alipay.go +++ b/internal/servants/web/alipay.go @@ -80,7 +80,7 @@ func (s *alipayPrivSrv) UserRechargeLink(req *web.UserRechargeLinkReq) (*web.Use p.Subject = "PaoPao用户钱包充值" p.TotalAmount = fmt.Sprintf("%.2f", float64(recharge.Amount)/100.0) p.NotifyURL = "https://" + req.Host + "/v1/alipay/notify" - rsp, err := s.alipayClient.TradePreCreate(p) + rsp, err := s.alipayClient.TradePreCreate(req.Ctx, p) if err != nil { logrus.Errorf("client.TradePreCreate err: %v\n", err) return nil, web.ErrRechargeReqFail