From 7a5ad5a57035bc92f14c26b1680249c8548fe4de Mon Sep 17 00:00:00 2001 From: DengBiao <2319963317@qq.com> Date: Mon, 1 Apr 2024 11:28:46 +0800 Subject: [PATCH] update --- app/customer/svc/svc_pay.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/customer/svc/svc_pay.go b/app/customer/svc/svc_pay.go index b26b1a9..e654989 100644 --- a/app/customer/svc/svc_pay.go +++ b/app/customer/svc/svc_pay.go @@ -215,6 +215,10 @@ func BuyPackageForWx(c *gin.Context, req md.BuyPackageReq) (outTradeNo, total st sysCfg := sysCfgDb.SysCfgFindWithDb(enum2.WxAppletAppId, enum2.WxSpAppId, enum2.WxSpMchId, enum2.WxAppletAppId, enum2.WxJsapiPayNotifyUrl) fmt.Println(int64(math.Round(totalPrice * 100))) + openId := c.GetHeader("open_id") + if openId == "" { + openId = user.OpenId + } result, _, err := wxSvc.Prepay(c, jsapi.PrepayRequest{ SpAppid: core.String(sysCfg[enum2.WxSpAppId]), @@ -232,7 +236,7 @@ func BuyPackageForWx(c *gin.Context, req md.BuyPackageReq) (outTradeNo, total st }, Payer: &jsapi.Payer{ //SpOpenid: core.String("oUpF8uMuAJO_M2pxb1Q9zNjWeS6o"), - SubOpenid: core.String(user.OpenId), + SubOpenid: core.String(openId), }, }, )