From 496059422882daaba252aa4913d79c7e4ffafe59 Mon Sep 17 00:00:00 2001 From: Leufolium Date: Fri, 28 Jun 2024 15:35:12 +0800 Subject: [PATCH] by Robin at 20240628 --- app/mix/dao/mysql.go | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/app/mix/dao/mysql.go b/app/mix/dao/mysql.go index 2b7af240..a0693c0b 100644 --- a/app/mix/dao/mysql.go +++ b/app/mix/dao/mysql.go @@ -1029,21 +1029,18 @@ func (m *Mysql) GetWithdrawOrdersByMid(ctx *gin.Context, tx *sqlx.Tx, mid, st, e // 从订单号获取提现订单 func (m *Mysql) GetWithdrawOrderById(ctx *gin.Context, tx *sqlx.Tx, id string) (wOrder *dbstruct.WithdrawOrder, err error) { - wOrder = &dbstruct.WithdrawOrder{} + var tmpOrder dbstruct.WithdrawOrder sqlStr := fmt.Sprintf("select * from %s where id=?", TableWithdrawOrder) if tx != nil { - err = tx.SelectContext(ctx, wOrder, sqlStr, id) + err = tx.GetContext(ctx, &tmpOrder, sqlStr, id) } else { db := m.getDBVas() - err = db.SelectContext(ctx, wOrder, sqlStr, id) - } - if err == sql.ErrNoRows { - err = nil - return + err = db.GetContext(ctx, &tmpOrder, sqlStr, id) } if err != nil { return } + wOrder = &tmpOrder return }