fix recover

This commit is contained in:
lwl0608 2024-03-21 20:31:12 +08:00
parent 53086cde6c
commit bbcfcb3b95
2 changed files with 5 additions and 1 deletions

View File

@ -524,6 +524,10 @@ func (m *Mysql) UpdateCoinOrderStatus(ctx *gin.Context, tx *sqlx.Tx, orderId str
// 获取金币订单 for update
func (m *Mysql) GetCoinOrderByIdForUpdate(ctx *gin.Context, tx *sqlx.Tx, id string) (order *dbstruct.CoinOrder, err error) {
if tx == nil {
err = errors.New("tx is must require")
return
}
var tmpOrder dbstruct.CoinOrder
err = tx.GetContext(ctx, &tmpOrder, fmt.Sprintf("select * from %s where id = ? for update", TableCoinOrder), id)
if err != nil {

View File

@ -9,7 +9,7 @@ import (
// 获取金币订单
func (v *Vas) OpCoinOrderList(ctx *gin.Context, req *vasproto.OpCoinOrderListReq) ([]*dbstruct.CoinOrder, error) {
if len(req.OrderId) > 0 {
o, err := v.store.GetCoinOrderByIdForUpdate(ctx, nil, req.OrderId)
o, err := v.store.GetCoinOrderById(ctx, nil, req.OrderId)
return []*dbstruct.CoinOrder{o}, err
}
return v.store.GetCoinOrders(ctx, nil, req.Mid, req.St, req.Et, req.Offset, req.Limit)