ctx
This commit is contained in:
parent
e9b5ea3e7d
commit
8c9cd3b345
|
|
@ -15,6 +15,6 @@ func NewDb(db *GormDb) *Db {
|
|||
}
|
||||
}
|
||||
|
||||
func (d *Db) DB(_ context.Context) *gorm.DB {
|
||||
return d.db.Client
|
||||
func (d *Db) DB(ctx context.Context) *gorm.DB {
|
||||
return d.db.Client.WithContext(ctx)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ func NewOrderRepoImpl(db *data.Db) repo.OrderRepo {
|
|||
}
|
||||
|
||||
func (p *OrderRepoImpl) DB(ctx context.Context) *gorm.DB {
|
||||
return p.db.DB(ctx).WithContext(ctx).Model(model.Order{})
|
||||
return p.db.DB(ctx).Model(model.Order{})
|
||||
}
|
||||
|
||||
func (p *OrderRepoImpl) FindInBatches(ctx context.Context, w *bo.FindInBatchesUseBo, fun func(ctx context.Context, rows []*bo.OrderBo) error) error {
|
||||
|
|
@ -94,7 +94,7 @@ func (p *OrderRepoImpl) GetByOutBizNo(ctx context.Context, t vo.OrderType, outBi
|
|||
|
||||
info := &model.Order{}
|
||||
|
||||
db := p.db.DB(ctx).WithContext(ctx).Model(model.Order{})
|
||||
db := p.DB(ctx)
|
||||
tx := db.Where(model.Order{Type: t.GetValue(), OutBizNo: outBizNo}).First(&info)
|
||||
|
||||
if tx.Error != nil {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ func NewOrderNotifyRepoImpl(db *data.Db) repo.OrderNotifyRepo {
|
|||
}
|
||||
|
||||
func (p *OrderNotifyRepoImpl) DB(ctx context.Context) *gorm.DB {
|
||||
return p.db.DB(ctx).WithContext(ctx).Model(model.OrderNotify{})
|
||||
return p.db.DB(ctx).Model(model.OrderNotify{})
|
||||
}
|
||||
|
||||
func (p *OrderNotifyRepoImpl) GetByID(ctx context.Context, id uint64) (*bo.OrderNotifyBo, error) {
|
||||
|
|
|
|||
|
|
@ -84,7 +84,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.DB(ctx).WithContext(ctx).Model(model.Product{})
|
||||
db := r.db.DB(ctx).Model(model.Product{})
|
||||
tx := db.Where(model.Product{ProductNo: productNo}).First(&item)
|
||||
|
||||
if tx.Error != nil {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ func NewWechatNotifyRegisterTagRepoImpl(db *data.Db) repo.WechatNotifyRegisterTa
|
|||
}
|
||||
|
||||
func (p *WechatNotifyRegisterTagRepoImpl) DB(ctx context.Context) *gorm.DB {
|
||||
return p.db.DB(ctx).WithContext(ctx).Model(model.WechatNotifyRegisterTag{})
|
||||
return p.db.DB(ctx).Model(model.WechatNotifyRegisterTag{})
|
||||
}
|
||||
|
||||
func (p *WechatNotifyRegisterTagRepoImpl) GetByStockIdAndMchId(ctx context.Context, stockCreatorMchID, stockId string) (*bo.WechatNotifyRegisterTagBo, error) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue