diff --git a/app/customer/svc/svc_pay.go b/app/customer/svc/svc_pay.go index 5923100..cf812f0 100644 --- a/app/customer/svc/svc_pay.go +++ b/app/customer/svc/svc_pay.go @@ -18,6 +18,7 @@ import ( jsapi2 "github.com/wechatpay-apiv3/wechatpay-go/services/payments/jsapi" utils2 "github.com/wechatpay-apiv3/wechatpay-go/utils" "io/ioutil" + "math" "net/url" "strconv" "time" @@ -204,7 +205,7 @@ func BuyPackageForWx(c *gin.Context, req md.BuyPackageReq) (outTradeNo, total st } wxSvc := jsapi.JsapiApiService{Client: client} sysCfg := sysCfgDb.SysCfgFindWithDb(enum2.WxAppletAppId, enum2.WxSpAppId, enum2.WxSpMchId, enum2.WxAppletAppId, enum2.WxMchId, enum2.WxJsapiPayNotifyUrl) - + fmt.Println(int64(math.Round(totalPrice * 100))) result, _, err := wxSvc.Prepay(c, jsapi.PrepayRequest{ SpAppid: core.String(sysCfg[enum2.WxSpAppId]), @@ -218,7 +219,7 @@ func BuyPackageForWx(c *gin.Context, req md.BuyPackageReq) (outTradeNo, total st NotifyUrl: core.String(sysCfg[enum2.WxJsapiPayNotifyUrl]), Amount: &jsapi.Amount{ Currency: core.String("CNY"), - Total: core.Int64(int64(totalPrice * 100)), + Total: core.Int64(int64(math.Round(totalPrice * 100))), }, Payer: &jsapi.Payer{ //SpOpenid: core.String("oUpF8uMuAJO_M2pxb1Q9zNjWeS6o"),