diff --git a/internal/data/repoimpl/order.go b/internal/data/repoimpl/order.go index 500980f..f4f2062 100644 --- a/internal/data/repoimpl/order.go +++ b/internal/data/repoimpl/order.go @@ -33,7 +33,7 @@ func (p *OrderRepoImpl) FindInBatches(ctx context.Context, w *bo.FindInBatchesUs var results = make([]*model.Order, 0) - result := p.db.DB(ctx). + result := p.DB(ctx). Where("type = ?", w.Type). Where("status IN (?)", []uint8{vo.OrderStatusSuccess.GetValue(), vo.OrderStatusUse.GetValue()}). Where("receive_success_time BETWEEN ? AND ?", w.StartTime, w.EndTime). @@ -73,7 +73,7 @@ func (p *OrderRepoImpl) Create(ctx context.Context, req *bo.OrderBo) (*bo.OrderB UpdateTime: &now, } - tx := p.db.DB(ctx).Create(info) + tx := p.DB(ctx).Create(info) if tx.Error != nil { return nil, fmt.Errorf("create db fail %w", tx.Error) } @@ -148,7 +148,7 @@ func (p *OrderRepoImpl) GetByMBV(ctx context.Context, merchantNo, batchNo, vouch func (p *OrderRepoImpl) Ing(ctx context.Context, id uint64) error { now := time.Now() - tx := p.db.DB(ctx). + tx := p.DB(ctx). Where(model.Order{ ID: id, Status: vo.OrderStatusWait.GetValue(), @@ -168,7 +168,7 @@ func (p *OrderRepoImpl) Ing(ctx context.Context, id uint64) error { func (p *OrderRepoImpl) Success(ctx context.Context, id uint64, voucherNo string) error { now := time.Now() - tx := p.db.DB(ctx). + tx := p.DB(ctx). Where(model.Order{ ID: id, Status: vo.OrderStatusIng.GetValue(), @@ -190,7 +190,7 @@ func (p *OrderRepoImpl) Success(ctx context.Context, id uint64, voucherNo string func (p *OrderRepoImpl) Available(ctx context.Context, id uint64) error { now := time.Now() - tx := p.db.DB(ctx). + tx := p.DB(ctx). Where(model.Order{ ID: id, Status: vo.OrderStatusUse.GetValue(), @@ -218,7 +218,7 @@ func (p *OrderRepoImpl) Fail(ctx context.Context, id uint64, remark string) erro } } - tx := p.db.DB(ctx). + tx := p.DB(ctx). Where(model.Order{ ID: id, }). @@ -238,7 +238,7 @@ func (p *OrderRepoImpl) Fail(ctx context.Context, id uint64, remark string) erro func (p *OrderRepoImpl) Used(ctx context.Context, id uint64) error { now := time.Now() - tx := p.db.DB(ctx). + tx := p.DB(ctx). Where(model.Order{ ID: id, }). @@ -258,7 +258,7 @@ func (p *OrderRepoImpl) Used(ctx context.Context, id uint64) error { func (p *OrderRepoImpl) Expired(ctx context.Context, id uint64) error { now := time.Now() - tx := p.db.DB(ctx). + tx := p.DB(ctx). Where(model.Order{ ID: id, }). diff --git a/internal/data/repoimpl/order_notify.go b/internal/data/repoimpl/order_notify.go index 2ab9e67..ac0c6ca 100644 --- a/internal/data/repoimpl/order_notify.go +++ b/internal/data/repoimpl/order_notify.go @@ -71,7 +71,7 @@ func (p *OrderNotifyRepoImpl) Create(ctx context.Context, req *bo.OrderNotifyBo) UpdateTime: &now, } - if err := p.db.DB(ctx).Create(info).Error; err != nil { + if err := p.DB(ctx).Create(info).Error; err != nil { return nil, err } @@ -81,7 +81,7 @@ func (p *OrderNotifyRepoImpl) Create(ctx context.Context, req *bo.OrderNotifyBo) func (p *OrderNotifyRepoImpl) Success(ctx context.Context, id uint64, responses string) error { now := time.Now() - res := p.db.DB(ctx). + res := p.DB(ctx). Where(model.OrderNotify{ ID: id, Status: vo.OrderNotifyStatusWait.GetValue(), @@ -110,7 +110,7 @@ func (p *OrderNotifyRepoImpl) Fail(ctx context.Context, id uint64, remark string now := time.Now() - res := p.db.DB(ctx). + res := p.DB(ctx). Where(model.OrderNotify{ ID: id, Status: vo.OrderNotifyStatusWait.GetValue(), diff --git a/internal/data/repoimpl/wechat_notify_register_tag.go b/internal/data/repoimpl/wechat_notify_register_tag.go index aac8dab..fe4c493 100644 --- a/internal/data/repoimpl/wechat_notify_register_tag.go +++ b/internal/data/repoimpl/wechat_notify_register_tag.go @@ -55,7 +55,7 @@ func (p *WechatNotifyRegisterTagRepoImpl) Create(ctx context.Context, req *bo.We CreateTime: &now, } - if err := p.db.DB(ctx).Create(info).Error; err != nil { + if err := p.DB(ctx).Create(info).Error; err != nil { return nil, err } @@ -65,7 +65,7 @@ func (p *WechatNotifyRegisterTagRepoImpl) Create(ctx context.Context, req *bo.We func (p *WechatNotifyRegisterTagRepoImpl) Success(ctx context.Context, id int32) error { now := time.Now() - res := p.db.DB(ctx). + res := p.DB(ctx). Where(model.WechatNotifyRegisterTag{ ID: id, Status: vo.WechatNotifyRegisterTagStatusWait.GetValue(), @@ -93,7 +93,7 @@ func (p *WechatNotifyRegisterTagRepoImpl) Fail(ctx context.Context, id int32, re now := time.Now() - res := p.db.DB(ctx). + res := p.DB(ctx). Where(model.WechatNotifyRegisterTag{ ID: id, Status: vo.WechatNotifyRegisterTagStatusWait.GetValue(),