微信支付时,body必须填
This commit is contained in:
@@ -124,9 +124,10 @@ func Pay4Order(ctx *jxcontext.Context, orderID int64, payType int, vendorPayType
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
switch payType {
|
switch payType {
|
||||||
case model.PayTypeWX:
|
case model.PayTypeWX:
|
||||||
orderPay, err = pay4OrderByWX(ctx, order, vendorPayType)
|
if orderPay, err = pay4OrderByWX(ctx, order, vendorPayType); err == nil {
|
||||||
dao.WrapAddIDCULDEntity(orderPay, ctx.GetUserName())
|
dao.WrapAddIDCULDEntity(orderPay, ctx.GetUserName())
|
||||||
err = dao.CreateEntity(dao.GetDB(), orderPay)
|
err = dao.CreateEntity(dao.GetDB(), orderPay)
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
err = fmt.Errorf("支付方式:%d当前不支持", payType)
|
err = fmt.Errorf("支付方式:%d当前不支持", payType)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package localjx
|
package localjx
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"git.rosy.net.cn/baseapi/platformapi/wxpay"
|
"git.rosy.net.cn/baseapi/platformapi/wxpay"
|
||||||
@@ -18,10 +19,14 @@ func vendorPayType2WxpayType(vendorPayType string) string {
|
|||||||
return vendorPayType
|
return vendorPayType
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getOrderBrief(order *model.GoodsOrder) string {
|
||||||
|
return fmt.Sprintf("%s等共%d件商品", order.Skus[0].SkuName, order.GoodsCount)
|
||||||
|
}
|
||||||
|
|
||||||
func pay4OrderByWX(ctx *jxcontext.Context, order *model.GoodsOrder, vendorPayType string) (orderPay *model.OrderPay, err error) {
|
func pay4OrderByWX(ctx *jxcontext.Context, order *model.GoodsOrder, vendorPayType string) (orderPay *model.OrderPay, err error) {
|
||||||
payCreatedAt := time.Now()
|
payCreatedAt := time.Now()
|
||||||
param := &wxpay.CreateOrderParam{
|
param := &wxpay.CreateOrderParam{
|
||||||
Body: "",
|
Body: getOrderBrief(order),
|
||||||
NotifyURL: globals.WxpayNotifyURL,
|
NotifyURL: globals.WxpayNotifyURL,
|
||||||
OutTradeNo: order.VendorOrderID,
|
OutTradeNo: order.VendorOrderID,
|
||||||
SpbillCreateIP: ctx.GetRealRemoteIP(),
|
SpbillCreateIP: ctx.GetRealRemoteIP(),
|
||||||
|
|||||||
Reference in New Issue
Block a user