From d0d2d6c2df669d01cc88b43548a44a8ef3a5e3c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 6 Nov 2020 15:23:01 +0800 Subject: [PATCH] pay result --- business/jxstore/cms/order.go | 6 ++++-- business/jxstore/financial/financial.go | 1 + business/jxstore/financial/pay.go | 4 ++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/business/jxstore/cms/order.go b/business/jxstore/cms/order.go index ad105a44d..9bc700ff5 100644 --- a/business/jxstore/cms/order.go +++ b/business/jxstore/cms/order.go @@ -3,6 +3,8 @@ package cms import ( "fmt" + "git.rosy.net.cn/baseapi/platformapi/wxpayapi" + "git.rosy.net.cn/baseapi/utils" "git.rosy.net.cn/jx-callback/business/jxstore/financial" @@ -42,7 +44,7 @@ func CreateOrder(ctx *jxcontext.Context, orderType, price int) (orderID string, return order.OrderID, err } -func Pay(ctx *jxcontext.Context, orderID string, payType int, vendorPayType string) (result *model.Order, err error) { +func Pay(ctx *jxcontext.Context, orderID string, payType int, vendorPayType string) (result *wxpayapi.CreateOrderResult, err error) { var ( db = dao.GetDB() order = &model.Order{ @@ -65,7 +67,7 @@ func Pay(ctx *jxcontext.Context, orderID string, payType int, vendorPayType stri err = financial.AddUserBill(db, jxutils.GenBillID(), order.UserID) } err = payHandler.CreatePay() - return payHandler.Order, err + return payHandler.WxPayResult, err } func Cash(ctx *jxcontext.Context, orderID string, payType int, vendorPayType string) (errCode string, err error) { diff --git a/business/jxstore/financial/financial.go b/business/jxstore/financial/financial.go index 8c015a686..40f4cdb1a 100644 --- a/business/jxstore/financial/financial.go +++ b/business/jxstore/financial/financial.go @@ -58,6 +58,7 @@ func (p *PayHandler) CreatePay() (err error) { } result, err := api.WxpayAPI.CreateUnifiedOrder(param) if err == nil { + p.WxPayResult = result p.Order.PrepayID = result.PrepayID p.Order.Comment = result.CodeURL _, err = dao.UpdateEntity(dao.GetDB(), p.Order, "PrepayID", "Comment") diff --git a/business/jxstore/financial/pay.go b/business/jxstore/financial/pay.go index 414ca707a..da8ee2902 100644 --- a/business/jxstore/financial/pay.go +++ b/business/jxstore/financial/pay.go @@ -3,6 +3,8 @@ package financial import ( "fmt" + "git.rosy.net.cn/baseapi/platformapi/wxpayapi" + "git.rosy.net.cn/baseapi/utils" "git.rosy.net.cn/jx-callback/globals" @@ -16,6 +18,8 @@ type PayHandler struct { Ctx *jxcontext.Context Order *model.Order VendorPayType string + + WxPayResult *wxpayapi.CreateOrderResult `json:"wxPayResult"` } type PayHandlerInterface interface {