This commit is contained in:
richboo111
2022-07-28 13:46:14 +08:00
parent 7476e9a721
commit 16fa4f09ed

View File

@@ -150,6 +150,7 @@ func PayByBalance(ctx *jxcontext.Context, orderID string, restPrice, payType int
}() }()
if orderInfo.Status == NotPay { if orderInfo.Status == NotPay {
globals.SugarLogger.Debug("进入账单未支付") globals.SugarLogger.Debug("进入账单未支付")
globals.SugarLogger.Debug("user_bill.balance==================", userBill.AccountBalance)
if userBill.AccountBalance > 0 && restPrice == 0 { if userBill.AccountBalance > 0 && restPrice == 0 {
//余额 全款支付 //余额 全款支付
globals.SugarLogger.Debug("进入余额支付部分") globals.SugarLogger.Debug("进入余额支付部分")
@@ -159,7 +160,8 @@ func PayByBalance(ctx *jxcontext.Context, orderID string, restPrice, payType int
return "使用余额支付失败:", err return "使用余额支付失败:", err
} }
orderInfo.Status = AlreadyPay orderInfo.Status = AlreadyPay
} else { }
if restPrice != 0 {
//需支付部分 //需支付部分
//restPrice := orderInfo.PayPrice - userBill.AccountBalance //restPrice := orderInfo.PayPrice - userBill.AccountBalance
globals.SugarLogger.Debug("进入混合支付部分") globals.SugarLogger.Debug("进入混合支付部分")
@@ -175,6 +177,7 @@ func PayByBalance(ctx *jxcontext.Context, orderID string, restPrice, payType int
return "余额修改失败:", err return "余额修改失败:", err
} }
//增加一条用户账单 //增加一条用户账单
globals.SugarLogger.Debug("开始创建用户账单")
if err = financial.AddBillExpend(txDB, userBill.BillID, model.BillTypePayByAccountBalance, orderInfo.PayPrice, 0); err != nil { if err = financial.AddBillExpend(txDB, userBill.BillID, model.BillTypePayByAccountBalance, orderInfo.PayPrice, 0); err != nil {
globals.SugarLogger.Debug("创建账单失败") globals.SugarLogger.Debug("创建账单失败")
dao.Rollback(db, txDB) dao.Rollback(db, txDB)