This commit is contained in:
李子铭 2025-03-20 16:53:23 +08:00
parent 240cd23fb6
commit 70dbaf72c0
5 changed files with 8 additions and 8 deletions

View File

@ -35,14 +35,14 @@ func (s OrderNotifyEvent) IsUsed() bool {
return s == OrderNotifyEventUsed return s == OrderNotifyEventUsed
} }
func (s OrderNotifyEvent) CanNotify() bool {
return s.IsSendDEd() || s.IsUsed()
}
func (s OrderNotifyEvent) IsExpired() bool { func (s OrderNotifyEvent) IsExpired() bool {
return s == OrderNotifyEventExpired return s == OrderNotifyEventExpired
} }
func (s OrderNotifyEvent) CanNotify() bool {
return s.IsSendDEd() || s.IsUsed() || s.IsExpired()
}
var OrderNotifyEventMapCmbStatus = map[OrderNotifyEvent]CmbStatus{ var OrderNotifyEventMapCmbStatus = map[OrderNotifyEvent]CmbStatus{
OrderNotifyEventSendDEd: CmbStatusSuccess, OrderNotifyEventSendDEd: CmbStatusSuccess,
OrderNotifyEventUsed: CmbStatusUse, OrderNotifyEventUsed: CmbStatusUse,

View File

@ -26,7 +26,7 @@ func NewOrderRepoImpl(db *data.Db) repo.OrderRepo {
} }
func (p *OrderRepoImpl) DB(ctx context.Context) *gorm.DB { func (p *OrderRepoImpl) DB(ctx context.Context) *gorm.DB {
return p.db.DB(ctx).Model(model.Order{}) return p.db.DB(ctx).WithContext(ctx).Model(model.Order{})
} }
func (p *OrderRepoImpl) FindInBatches(ctx context.Context, w *bo.FindInBatchesUseBo, fun func(ctx context.Context, rows []*bo.OrderBo) error) error { func (p *OrderRepoImpl) FindInBatches(ctx context.Context, w *bo.FindInBatchesUseBo, fun func(ctx context.Context, rows []*bo.OrderBo) error) error {

View File

@ -25,7 +25,7 @@ func NewOrderNotifyRepoImpl(db *data.Db) repo.OrderNotifyRepo {
} }
func (p *OrderNotifyRepoImpl) DB(ctx context.Context) *gorm.DB { func (p *OrderNotifyRepoImpl) DB(ctx context.Context) *gorm.DB {
return p.db.DB(ctx).Model(model.OrderNotify{}) return p.db.DB(ctx).WithContext(ctx).Model(model.OrderNotify{})
} }
func (p *OrderNotifyRepoImpl) GetByID(ctx context.Context, id uint64) (*bo.OrderNotifyBo, error) { func (p *OrderNotifyRepoImpl) GetByID(ctx context.Context, id uint64) (*bo.OrderNotifyBo, error) {

View File

@ -23,7 +23,7 @@ func NewProductRepoImpl(db *data.Db) repo.ProductRepo {
} }
func (p *ProductRepoImpl) DB(ctx context.Context) *gorm.DB { func (p *ProductRepoImpl) DB(ctx context.Context) *gorm.DB {
return p.db.DB(ctx).Model(model.Product{}) return p.db.DB(ctx).WithContext(ctx).Model(model.Product{})
} }
func (r *ProductRepoImpl) GetByPNO(ctx context.Context, PNO string) (*bo.ProductBo, error) { func (r *ProductRepoImpl) GetByPNO(ctx context.Context, PNO string) (*bo.ProductBo, error) {

View File

@ -25,7 +25,7 @@ func NewWechatNotifyRegisterTagRepoImpl(db *data.Db) repo.WechatNotifyRegisterTa
} }
func (p *WechatNotifyRegisterTagRepoImpl) DB(ctx context.Context) *gorm.DB { func (p *WechatNotifyRegisterTagRepoImpl) DB(ctx context.Context) *gorm.DB {
return p.db.DB(ctx).Model(model.WechatNotifyRegisterTag{}) return p.db.DB(ctx).WithContext(ctx).Model(model.WechatNotifyRegisterTag{})
} }
func (p *WechatNotifyRegisterTagRepoImpl) GetByStockIdAndMchId(ctx context.Context, stockCreatorMchID, stockId string) (*bo.WechatNotifyRegisterTagBo, error) { func (p *WechatNotifyRegisterTagRepoImpl) GetByStockIdAndMchId(ctx context.Context, stockCreatorMchID, stockId string) (*bo.WechatNotifyRegisterTagBo, error) {