满足压测处理
This commit is contained in:
parent
2cdb04c522
commit
4f71228ff1
|
|
@ -92,7 +92,7 @@ func (p *OrderRepoImpl) GetByOutBizNo(ctx context.Context, t vo.OrderType, outBi
|
|||
|
||||
info := &model.Order{}
|
||||
|
||||
db := p.DB(ctx)
|
||||
db := p.db.DB(ctx).WithContext(ctx).Model(model.Order{})
|
||||
tx := db.Where(model.Order{Type: t.GetValue(), OutBizNo: outBizNo}).First(&info)
|
||||
|
||||
if tx.Error != nil {
|
||||
|
|
@ -122,9 +122,11 @@ func (p *OrderRepoImpl) GetByID(ctx context.Context, id uint64) (*bo.OrderBo, er
|
|||
tx := p.DB(ctx).Where(model.Order{ID: id}).First(&info)
|
||||
|
||||
if tx.Error != nil {
|
||||
|
||||
if errors.Is(tx.Error, gorm.ErrRecordNotFound) {
|
||||
return nil, err2.ErrorDbNotFound("订单数据不存在")
|
||||
}
|
||||
|
||||
return nil, fmt.Errorf("order db fail %w", tx.Error)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ func (r *ProductRepoImpl) GetByProductNo(ctx context.Context, productNo string)
|
|||
|
||||
func (r *ProductRepoImpl) getByProductNo(ctx context.Context, item *model.Product, productNo string) (*model.Product, error) {
|
||||
|
||||
db := r.DB(ctx)
|
||||
db := r.db.DB(ctx).WithContext(ctx).Model(model.Product{})
|
||||
tx := db.Where(model.Product{ProductNo: productNo}).First(&item)
|
||||
|
||||
if tx.Error != nil {
|
||||
|
|
|
|||
Loading…
Reference in New Issue