fix recover
This commit is contained in:
parent
53086cde6c
commit
bbcfcb3b95
|
@ -524,6 +524,10 @@ func (m *Mysql) UpdateCoinOrderStatus(ctx *gin.Context, tx *sqlx.Tx, orderId str
|
||||||
|
|
||||||
// 获取金币订单 for update
|
// 获取金币订单 for update
|
||||||
func (m *Mysql) GetCoinOrderByIdForUpdate(ctx *gin.Context, tx *sqlx.Tx, id string) (order *dbstruct.CoinOrder, err error) {
|
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
|
var tmpOrder dbstruct.CoinOrder
|
||||||
err = tx.GetContext(ctx, &tmpOrder, fmt.Sprintf("select * from %s where id = ? for update", TableCoinOrder), id)
|
err = tx.GetContext(ctx, &tmpOrder, fmt.Sprintf("select * from %s where id = ? for update", TableCoinOrder), id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
// 获取金币订单
|
// 获取金币订单
|
||||||
func (v *Vas) OpCoinOrderList(ctx *gin.Context, req *vasproto.OpCoinOrderListReq) ([]*dbstruct.CoinOrder, error) {
|
func (v *Vas) OpCoinOrderList(ctx *gin.Context, req *vasproto.OpCoinOrderListReq) ([]*dbstruct.CoinOrder, error) {
|
||||||
if len(req.OrderId) > 0 {
|
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 []*dbstruct.CoinOrder{o}, err
|
||||||
}
|
}
|
||||||
return v.store.GetCoinOrders(ctx, nil, req.Mid, req.St, req.Et, req.Offset, req.Limit)
|
return v.store.GetCoinOrders(ctx, nil, req.Mid, req.St, req.Et, req.Offset, req.Limit)
|
||||||
|
|
Loading…
Reference in New Issue