diff --git a/business/jxstore/cms/order.go b/business/jxstore/cms/order.go index 7450c05a3..5111dea5d 100644 --- a/business/jxstore/cms/order.go +++ b/business/jxstore/cms/order.go @@ -127,13 +127,16 @@ var ( func PayByBalance(ctx *jxcontext.Context, orderID string, restPrice, payType int, vendorPayType, appID string) (errMsg string, err error) { var ( db = dao.GetDB() + //wxPayParam *financial.WxPayParam ) //获取订单信息 + globals.SugarLogger.Debug("begin get order+info") orderInfo, err := dao.GetOrderByID(db, orderID) if err != nil { return "获取订单信息失败", err } //获取用户 会员账户信息 + globals.SugarLogger.Debug("开始获取会员信息") userBill, err := dao.GetUserBill(db, orderInfo.UserID, "") if err != nil { return "获取用户会员账户余额失败", err @@ -146,8 +149,10 @@ func PayByBalance(ctx *jxcontext.Context, orderID string, restPrice, payType int } }() if orderInfo.Status == NotPay { + globals.SugarLogger.Debug("进入账单未支付") if userBill.AccountBalance > 0 && restPrice == 0 { //余额 全款支付 + globals.SugarLogger.Debug("进入余额支付部分") if userBill.AccountBalance > orderInfo.PayPrice && userBill.AccountBalance-orderInfo.PayPrice > 0 { if err = financial.AddExpendUpdateAccount(txDB, userBill, model.BillTypePayByAccountBalance, orderInfo.PayPrice, 0); err != nil { dao.Rollback(db, txDB) @@ -157,21 +162,25 @@ func PayByBalance(ctx *jxcontext.Context, orderID string, restPrice, payType int } else { //需支付部分 //restPrice := orderInfo.PayPrice - userBill.AccountBalance + globals.SugarLogger.Debug("进入混合支付部分") orderInfo.PayPrice = restPrice - if _, err := Pay(ctx, orderInfo.OrderID, payType, vendorPayType, appID); err != nil { + _, err := Pay(ctx, orderInfo.OrderID, payType, vendorPayType, appID) + if err != nil { return "微信支付失败:", err } //支付成功后修改余额为0 if err := dao.UpdateUserBill(orderInfo.UserID, 0); err != nil { + globals.SugarLogger.Debug("支付后修改余额失败") dao.Rollback(db, txDB) return "余额修改失败:", err } //增加一条用户账单 if err = financial.AddBillExpend(txDB, userBill.BillID, model.BillTypePayByAccountBalance, orderInfo.PayPrice, 0); err != nil { + globals.SugarLogger.Debug("创建账单失败") dao.Rollback(db, txDB) - return "使用余额支付失败:", err + return "创建账单失败", err } - + return "混合支付成功", err } } dao.Commit(db, txDB)