Browse Source

update

add_mode
DengBiao 1 year ago
parent
commit
d3f648e02d
1 changed files with 3 additions and 2 deletions
  1. +3
    -2
      app/customer/svc/svc_pay.go

+ 3
- 2
app/customer/svc/svc_pay.go View File

@@ -18,6 +18,7 @@ import (
jsapi2 "github.com/wechatpay-apiv3/wechatpay-go/services/payments/jsapi" jsapi2 "github.com/wechatpay-apiv3/wechatpay-go/services/payments/jsapi"
utils2 "github.com/wechatpay-apiv3/wechatpay-go/utils" utils2 "github.com/wechatpay-apiv3/wechatpay-go/utils"
"io/ioutil" "io/ioutil"
"math"
"net/url" "net/url"
"strconv" "strconv"
"time" "time"
@@ -204,7 +205,7 @@ func BuyPackageForWx(c *gin.Context, req md.BuyPackageReq) (outTradeNo, total st
} }
wxSvc := jsapi.JsapiApiService{Client: client} wxSvc := jsapi.JsapiApiService{Client: client}
sysCfg := sysCfgDb.SysCfgFindWithDb(enum2.WxAppletAppId, enum2.WxSpAppId, enum2.WxSpMchId, enum2.WxAppletAppId, enum2.WxMchId, enum2.WxJsapiPayNotifyUrl) 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, result, _, err := wxSvc.Prepay(c,
jsapi.PrepayRequest{ jsapi.PrepayRequest{
SpAppid: core.String(sysCfg[enum2.WxSpAppId]), 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]), NotifyUrl: core.String(sysCfg[enum2.WxJsapiPayNotifyUrl]),
Amount: &jsapi.Amount{ Amount: &jsapi.Amount{
Currency: core.String("CNY"), Currency: core.String("CNY"),
Total: core.Int64(int64(totalPrice * 100)),
Total: core.Int64(int64(math.Round(totalPrice * 100))),
}, },
Payer: &jsapi.Payer{ Payer: &jsapi.Payer{
//SpOpenid: core.String("oUpF8uMuAJO_M2pxb1Q9zNjWeS6o"), //SpOpenid: core.String("oUpF8uMuAJO_M2pxb1Q9zNjWeS6o"),


Loading…
Cancel
Save