错误映射

This commit is contained in:
ziming 2026-03-13 16:05:06 +08:00
parent 81c53823af
commit 07bacd006b
2 changed files with 38 additions and 38 deletions

View File

@ -12,8 +12,8 @@ type OrderRepo interface {
FinUsedInBatches(ctx context.Context, req *do.WechatUsedQuery, fun func(ctx context.Context, rows []*bo.OrderBo) error) error 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 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 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 //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 //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 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 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) GetByOutBizNo(ctx context.Context, t vo.OrderType, outBizNo string) (*bo.OrderBo, error)

View File

@ -145,43 +145,43 @@ func (p *OrderRepoImpl) FinUsedInBatches(ctx context.Context, req *do.WechatUsed
return nil 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) //func (p *OrderRepoImpl) FindIngInBatches(ctx context.Context, fun func(ctx context.Context, rows []*bo.OrderBo) error) error {
//
result := p.DB(ctx). // var results = make([]*model.Order, 0)
Where("batch_no = ?", batchNo). //
Where("`status` = ?", vo.OrderStatusFail.GetValue()). // result := p.DB(ctx).
Order("receive_success_time asc"). // 显式清除排序,移除默认的 ORDER BY // Where("`status` = ?", vo.OrderStatusIng.GetValue()).
FindInBatches(&results, 200, func(tx *gorm.DB, batch int) error { // Limit(20).
return fun(ctx, p.ToBos(results)) // 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 //
} // if result.Error != nil {
// return result.Error
return nil // }
} //
// 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 { func (p *OrderRepoImpl) FindInBatches(ctx context.Context, req *bo.FindInBatchesUseBo, fun func(ctx context.Context, rows []*bo.OrderBo) error) error {