From 4b1b0114594574c506363577354eefe9c922c27c Mon Sep 17 00:00:00 2001 From: gazebo Date: Wed, 27 Nov 2019 08:44:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E6=94=AF=E4=BB=98=E6=97=B6?= =?UTF-8?q?=EF=BC=8Cbody=E5=BF=85=E9=A1=BB=E5=A1=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/partner/purchase/jx/localjx/order.go | 7 ++++--- business/partner/purchase/jx/localjx/wxpay.go | 7 ++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/business/partner/purchase/jx/localjx/order.go b/business/partner/purchase/jx/localjx/order.go index 40bd4b286..c5deedb71 100644 --- a/business/partner/purchase/jx/localjx/order.go +++ b/business/partner/purchase/jx/localjx/order.go @@ -124,9 +124,10 @@ func Pay4Order(ctx *jxcontext.Context, orderID int64, payType int, vendorPayType if err == nil { switch payType { case model.PayTypeWX: - orderPay, err = pay4OrderByWX(ctx, order, vendorPayType) - dao.WrapAddIDCULDEntity(orderPay, ctx.GetUserName()) - err = dao.CreateEntity(dao.GetDB(), orderPay) + if orderPay, err = pay4OrderByWX(ctx, order, vendorPayType); err == nil { + dao.WrapAddIDCULDEntity(orderPay, ctx.GetUserName()) + err = dao.CreateEntity(dao.GetDB(), orderPay) + } default: err = fmt.Errorf("支付方式:%d当前不支持", payType) } diff --git a/business/partner/purchase/jx/localjx/wxpay.go b/business/partner/purchase/jx/localjx/wxpay.go index 6519d3edb..f1450aa8c 100644 --- a/business/partner/purchase/jx/localjx/wxpay.go +++ b/business/partner/purchase/jx/localjx/wxpay.go @@ -1,6 +1,7 @@ package localjx import ( + "fmt" "time" "git.rosy.net.cn/baseapi/platformapi/wxpay" @@ -18,10 +19,14 @@ func vendorPayType2WxpayType(vendorPayType string) string { 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) { payCreatedAt := time.Now() param := &wxpay.CreateOrderParam{ - Body: "", + Body: getOrderBrief(order), NotifyURL: globals.WxpayNotifyURL, OutTradeNo: order.VendorOrderID, SpbillCreateIP: ctx.GetRealRemoteIP(),