add 充值到余额订单

This commit is contained in:
richboo111
2022-08-08 14:04:42 +08:00
parent b393bd17b8
commit 9476a98b69
4 changed files with 85 additions and 117 deletions

View File

@@ -272,8 +272,12 @@ func onTLpayFinished(call *tonglianpayapi.CallBackResult) (err error) {
//充值会员 增加微信支付处理业务
if (order.OrderType == 2 || order.OrderType == 5) && call.TrxStatus == tonglianpayapi.TrxStatusSuccess {
if err := OnWXPayFinished(order); err != nil {
return err
}
return OnWXPayFinished(order)
} else if order.OrderType == 3 && call.TrxStatus == tonglianpayapi.TrxStatusSuccess {
}
if order.OrderType == 3 && call.TrxStatus == tonglianpayapi.TrxStatusSuccess {
globals.SugarLogger.Debug("得到微信回调结果,快递流程开始")
txdb, _ := dao.Begin(db)
defer func() {
@@ -293,12 +297,6 @@ func onTLpayFinished(call *tonglianpayapi.CallBackResult) (err error) {
dao.Rollback(db, txdb)
return err
}
//测试order 数据库是否更新成功
order_test, err := dao.GetOrderByID(db, order.OrderID)
globals.SugarLogger.Debug("再次从数据库拿order.TransactionID", order_test.TransactionID)
globals.SugarLogger.Debug("再次从数据库拿order.Status", order_test.Status)
////////////////////////////////////
globals.SugarLogger.Debug("获取UserVendorOrder")
userOrder := model.UserVendorOrder{LocalWayBill: order.OrderID}
if err := dao.GetEntity(db, &userOrder, "LocalWayBill"); err != nil {
@@ -346,6 +344,12 @@ func onTLpayFinished(call *tonglianpayapi.CallBackResult) (err error) {
}
return err
}
//需要充值到余额方式 购买的
if order.OrderType == 6 && call.TrxStatus == tonglianpayapi.TrxStatusSuccess {
if err := dao.UpdateUserBill(order.UserID, order.PayPrice); err != nil {
return err
}
}
} else {
globals.SugarLogger.Debugf("onTLpayFinished msg:%s, err:%v", utils.Format4Output(call, true), err)
}