diff --git a/business/jxstore/cms/order.go b/business/jxstore/cms/order.go index d0e50e3af..85d8c6a4c 100644 --- a/business/jxstore/cms/order.go +++ b/business/jxstore/cms/order.go @@ -108,12 +108,14 @@ func Pay(ctx *jxcontext.Context, orderID string, payType int, vendorPayType, app }() // 给用户创建一个银行卡账户 + globals.SugarLogger.Debugf("createbill begin……") userBill, err := dao.GetUserBill(db, order.UserID, "") if userBill == nil { err = financial.AddUserBill(txDB, jxutils.GenBillID(), order.UserID) } err = payHandler.CreatePay(txDB, appId) dao.Commit(db, txDB) + globals.SugarLogger.Debug("the last step of this program,return err……", err) globals.SugarLogger.Debugf("result : %v", utils.Format4Output(payHandler.WxPayParam, false)) return payHandler.WxPayParam, err } @@ -168,11 +170,12 @@ func PayByBalance(ctx *jxcontext.Context, orderID string, restPrice, payType int globals.SugarLogger.Debug("进入混合支付部分") orderInfo.PayPrice = restPrice globals.SugarLogger.Debug("orderInfo.PayPrice=================", orderInfo.PayPrice) - _, err := Pay(ctx, orderInfo.OrderID, payType, vendorPayType, appID) - globals.SugarLogger.Debug("err=================", err) - if err != nil { + if _, err := Pay(ctx, orderInfo.OrderID, payType, vendorPayType, appID); err != nil { + //dao.Rollback(db, txDB) + globals.SugarLogger.Debug("err=================", err) return "微信支付失败:", err } + //支付成功后修改余额为0 if err := dao.UpdateUserBill(orderInfo.UserID, 0); err != nil { globals.SugarLogger.Debug("支付后修改余额失败")