diff --git a/go.mod b/go.mod index 9461c2cf..f90d1c83 100644 --- a/go.mod +++ b/go.mod @@ -36,7 +36,7 @@ require ( github.com/redis/rueidis v1.0.64 github.com/robfig/cron/v3 v3.0.1 github.com/sirupsen/logrus v1.9.3 - github.com/smartwalle/alipay/v3 v3.2.20 + github.com/smartwalle/alipay/v3 v3.2.29 github.com/sourcegraph/conc v0.3.0 github.com/spf13/cobra v1.9.1 github.com/spf13/viper v1.20.1 @@ -145,7 +145,7 @@ require ( github.com/rs/xid v1.6.0 // indirect github.com/sagikazarmark/locafero v0.7.0 // indirect github.com/smartwalle/ncrypto v1.0.4 // indirect - github.com/smartwalle/ngx v1.0.9 // indirect + github.com/smartwalle/ngx v1.1.0 // indirect github.com/smartwalle/nsign v1.0.9 // indirect github.com/spf13/afero v1.12.0 // indirect github.com/spf13/cast v1.7.1 // indirect diff --git a/go.sum b/go.sum index 68482cab..4a006ec2 100644 --- a/go.sum +++ b/go.sum @@ -297,12 +297,12 @@ github.com/sagikazarmark/locafero v0.7.0 h1:5MqpDsTGNDhY8sGp0Aowyf0qKsPrhewaLSsF github.com/sagikazarmark/locafero v0.7.0/go.mod h1:2za3Cg5rMaTMoG/2Ulr9AwtFaIppKXTRYnozin4aB5k= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= -github.com/smartwalle/alipay/v3 v3.2.20 h1:IjpG3YYgUgzCfS0z/EHlUbbr0OlrmOBHUst/3FzToYE= -github.com/smartwalle/alipay/v3 v3.2.20/go.mod h1:KWg91KsY+eIOf26ZfZeH7bed1bWulGpGrL1ErHF3jWo= +github.com/smartwalle/alipay/v3 v3.2.29 h1:roGFqlml8hDa//0TpFmlyxZhndTYs7rbYLu/HlNFNJo= +github.com/smartwalle/alipay/v3 v3.2.29/go.mod h1:XarBLuAkwK3ah7mYjVtghRu+ysxzlex9sRkgqNMzMRU= github.com/smartwalle/ncrypto v1.0.4 h1:P2rqQxDepJwgeO5ShoC+wGcK2wNJDmcdBOWAksuIgx8= github.com/smartwalle/ncrypto v1.0.4/go.mod h1:Dwlp6sfeNaPMnOxMNayMTacvC5JGEVln3CVdiVDgbBk= -github.com/smartwalle/ngx v1.0.9 h1:pUXDvWRZJIHVrCKA1uZ15YwNti+5P4GuJGbpJ4WvpMw= -github.com/smartwalle/ngx v1.0.9/go.mod h1:mx/nz2Pk5j+RBs7t6u6k22MPiBG/8CtOMpCnALIG8Y0= +github.com/smartwalle/ngx v1.1.0 h1:q8nANgWSPRGeI/u+ixBoA4mf68DrUq6vZ+n9L5UKv9I= +github.com/smartwalle/ngx v1.1.0/go.mod h1:mx/nz2Pk5j+RBs7t6u6k22MPiBG/8CtOMpCnALIG8Y0= github.com/smartwalle/nsign v1.0.9 h1:8poAgG7zBd8HkZy9RQDwasC6XZvJpDGQWSjzL2FZL6E= github.com/smartwalle/nsign v1.0.9/go.mod h1:eY6I4CJlyNdVMP+t6z1H6Jpd4m5/V+8xi44ufSTxXgc= github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= 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