错误映射
This commit is contained in:
parent
81c53823af
commit
07bacd006b
|
|
@ -12,8 +12,8 @@ type OrderRepo interface {
|
|||
FinUsedInBatches(ctx context.Context, req *do.WechatUsedQuery, fun func(ctx context.Context, rows []*bo.OrderBo) error) error
|
||||
SpecifyFindInBatches(ctx context.Context, w *bo.FindInBatchesBo, fun func(ctx context.Context, rows []*bo.OrderBo) error) error
|
||||
FinSucByStockIdInBatches(ctx context.Context, req *do.WechatQuery, fun func(ctx context.Context, rows []*bo.OrderBo) error) error
|
||||
FinFailByStockIdInBatches(ctx context.Context, batchNo string, fun func(ctx context.Context, rows []*bo.OrderBo) error) error
|
||||
FindIngInBatches(ctx context.Context, fun func(ctx context.Context, rows []*bo.OrderBo) error) error
|
||||
//FinFailByStockIdInBatches(ctx context.Context, batchNo string, fun func(ctx context.Context, rows []*bo.OrderBo) error) error
|
||||
//FindIngInBatches(ctx context.Context, fun func(ctx context.Context, rows []*bo.OrderBo) error) error
|
||||
FindInBatches(ctx context.Context, w *bo.FindInBatchesUseBo, fun func(ctx context.Context, rows []*bo.OrderBo) error) error
|
||||
FindRetryQuery(ctx context.Context, req *do.RetryQueryNotice, fun func(ctx context.Context, rows []*bo.OrderBo) error) error
|
||||
GetByOutBizNo(ctx context.Context, t vo.OrderType, outBizNo string) (*bo.OrderBo, error)
|
||||
|
|
|
|||
|
|
@ -145,43 +145,43 @@ func (p *OrderRepoImpl) FinUsedInBatches(ctx context.Context, req *do.WechatUsed
|
|||
return nil
|
||||
}
|
||||
|
||||
func (p *OrderRepoImpl) FinFailByStockIdInBatches(ctx context.Context, batchNo string, fun func(ctx context.Context, rows []*bo.OrderBo) error) error {
|
||||
//func (p *OrderRepoImpl) FinFailByStockIdInBatches(ctx context.Context, batchNo string, fun func(ctx context.Context, rows []*bo.OrderBo) error) error {
|
||||
//
|
||||
// var results = make([]*model.Order, 0)
|
||||
//
|
||||
// result := p.DB(ctx).
|
||||
// Where("batch_no = ?", batchNo).
|
||||
// Where("`status` = ?", vo.OrderStatusFail.GetValue()).
|
||||
// Order("receive_success_time asc"). // 显式清除排序,移除默认的 ORDER BY
|
||||
// FindInBatches(&results, 200, func(tx *gorm.DB, batch int) error {
|
||||
// return fun(ctx, p.ToBos(results))
|
||||
// })
|
||||
//
|
||||
// if result.Error != nil {
|
||||
// return result.Error
|
||||
// }
|
||||
//
|
||||
// return nil
|
||||
//}
|
||||
|
||||
var results = make([]*model.Order, 0)
|
||||
|
||||
result := p.DB(ctx).
|
||||
Where("batch_no = ?", batchNo).
|
||||
Where("`status` = ?", vo.OrderStatusFail.GetValue()).
|
||||
Order("receive_success_time asc"). // 显式清除排序,移除默认的 ORDER BY
|
||||
FindInBatches(&results, 200, func(tx *gorm.DB, batch int) error {
|
||||
return fun(ctx, p.ToBos(results))
|
||||
})
|
||||
|
||||
if result.Error != nil {
|
||||
return result.Error
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *OrderRepoImpl) FindIngInBatches(ctx context.Context, fun func(ctx context.Context, rows []*bo.OrderBo) error) error {
|
||||
|
||||
var results = make([]*model.Order, 0)
|
||||
|
||||
result := p.DB(ctx).
|
||||
Where("`status` = ?", vo.OrderStatusIng.GetValue()).
|
||||
Limit(20).
|
||||
Order("receive_success_time asc"). // 显式清除排序,移除默认的 ORDER BY
|
||||
FindInBatches(&results, 10, func(tx *gorm.DB, batch int) error {
|
||||
return fun(ctx, p.ToBos(results))
|
||||
})
|
||||
|
||||
if result.Error != nil {
|
||||
return result.Error
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
//func (p *OrderRepoImpl) FindIngInBatches(ctx context.Context, fun func(ctx context.Context, rows []*bo.OrderBo) error) error {
|
||||
//
|
||||
// var results = make([]*model.Order, 0)
|
||||
//
|
||||
// result := p.DB(ctx).
|
||||
// Where("`status` = ?", vo.OrderStatusIng.GetValue()).
|
||||
// Limit(20).
|
||||
// Order("receive_success_time asc"). // 显式清除排序,移除默认的 ORDER BY
|
||||
// FindInBatches(&results, 10, func(tx *gorm.DB, batch int) error {
|
||||
// return fun(ctx, p.ToBos(results))
|
||||
// })
|
||||
//
|
||||
// if result.Error != nil {
|
||||
// return result.Error
|
||||
// }
|
||||
//
|
||||
// return nil
|
||||
//}
|
||||
|
||||
func (p *OrderRepoImpl) FindInBatches(ctx context.Context, req *bo.FindInBatchesUseBo, fun func(ctx context.Context, rows []*bo.OrderBo) error) error {
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue