From 70dbaf72c0b8840fc863cad85d40d55d37d067e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=AD=90=E9=93=AD?= Date: Thu, 20 Mar 2025 16:53:23 +0800 Subject: [PATCH] db fail --- internal/biz/vo/order_notify_event.go | 8 ++++---- internal/data/repoimpl/order.go | 2 +- internal/data/repoimpl/order_notify.go | 2 +- internal/data/repoimpl/product.go | 2 +- internal/data/repoimpl/wechat_notify_register_tag.go | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/internal/biz/vo/order_notify_event.go b/internal/biz/vo/order_notify_event.go index 4d68229..db5fb45 100644 --- a/internal/biz/vo/order_notify_event.go +++ b/internal/biz/vo/order_notify_event.go @@ -35,14 +35,14 @@ func (s OrderNotifyEvent) IsUsed() bool { return s == OrderNotifyEventUsed } -func (s OrderNotifyEvent) CanNotify() bool { - return s.IsSendDEd() || s.IsUsed() -} - func (s OrderNotifyEvent) IsExpired() bool { return s == OrderNotifyEventExpired } +func (s OrderNotifyEvent) CanNotify() bool { + return s.IsSendDEd() || s.IsUsed() || s.IsExpired() +} + var OrderNotifyEventMapCmbStatus = map[OrderNotifyEvent]CmbStatus{ OrderNotifyEventSendDEd: CmbStatusSuccess, OrderNotifyEventUsed: CmbStatusUse, diff --git a/internal/data/repoimpl/order.go b/internal/data/repoimpl/order.go index fb16714..5413c16 100644 --- a/internal/data/repoimpl/order.go +++ b/internal/data/repoimpl/order.go @@ -26,7 +26,7 @@ func NewOrderRepoImpl(db *data.Db) repo.OrderRepo { } 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 { diff --git a/internal/data/repoimpl/order_notify.go b/internal/data/repoimpl/order_notify.go index ac0c6ca..a31bb38 100644 --- a/internal/data/repoimpl/order_notify.go +++ b/internal/data/repoimpl/order_notify.go @@ -25,7 +25,7 @@ func NewOrderNotifyRepoImpl(db *data.Db) repo.OrderNotifyRepo { } 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) { diff --git a/internal/data/repoimpl/product.go b/internal/data/repoimpl/product.go index f4a9b71..ff64094 100644 --- a/internal/data/repoimpl/product.go +++ b/internal/data/repoimpl/product.go @@ -23,7 +23,7 @@ func NewProductRepoImpl(db *data.Db) repo.ProductRepo { } 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) { diff --git a/internal/data/repoimpl/wechat_notify_register_tag.go b/internal/data/repoimpl/wechat_notify_register_tag.go index fe4c493..26d208d 100644 --- a/internal/data/repoimpl/wechat_notify_register_tag.go +++ b/internal/data/repoimpl/wechat_notify_register_tag.go @@ -25,7 +25,7 @@ func NewWechatNotifyRegisterTagRepoImpl(db *data.Db) repo.WechatNotifyRegisterTa } 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) {