From 813dfe5ef0397eed71490f145c981f544517b57b Mon Sep 17 00:00:00 2001 From: ziming Date: Wed, 25 Mar 2026 14:13:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=87=E6=8D=A2=E4=B8=BB=E4=BD=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/biz/repo/order.go | 1 - internal/biz/wechat_notify.go | 27 +-------------------------- internal/data/repoimpl/order.go | 16 ---------------- 3 files changed, 1 insertion(+), 43 deletions(-) diff --git a/internal/biz/repo/order.go b/internal/biz/repo/order.go index 633ff9a..62a2a3d 100644 --- a/internal/biz/repo/order.go +++ b/internal/biz/repo/order.go @@ -19,7 +19,6 @@ type OrderRepo interface { GetByOutBizNo(ctx context.Context, t vo.OrderType, outBizNo string) (*bo.OrderBo, error) GetByOrderNo(ctx context.Context, orderNo string) (*bo.OrderBo, error) GetByCouponId(ctx context.Context, merchantNo, batchNo, voucherNo string) (*bo.OrderBo, error) - GetByTransactionId(ctx context.Context, stockCreatorMchId, stockID, transactionId string) (*bo.OrderBo, error) Create(ctx context.Context, req *bo.OrderBo) (*bo.OrderBo, error) GetByID(ctx context.Context, id uint64) (*bo.OrderBo, error) Ing(ctx context.Context, id uint64) error diff --git a/internal/biz/wechat_notify.go b/internal/biz/wechat_notify.go index 2ddc5bb..cf19609 100644 --- a/internal/biz/wechat_notify.go +++ b/internal/biz/wechat_notify.go @@ -2,9 +2,7 @@ package biz import ( "context" - "errors" "fmt" - "gorm.io/gorm" errPb "voucher/api/err" "voucher/internal/biz/bo" "voucher/internal/biz/vo" @@ -48,30 +46,7 @@ func (this *VoucherBiz) getOrder(ctx context.Context, req *bo.WechatVoucherNotif order, err := this.OrderRepo.GetByCouponId(ctx, req.PlainText.StockCreatorMchid, req.PlainText.StockID, req.PlainText.CouponID) if err != nil { - - if !errors.Is(err, gorm.ErrRecordNotFound) { - return nil, err - } - - order, err = this.OrderRepo.GetByTransactionId(ctx, req.PlainText.StockCreatorMchid, req.PlainText.StockID, req.PlainText.ConsumeInformation.TransactionID) - - if err != nil { - - if errors.Is(err, gorm.ErrRecordNotFound) { - - return nil, fmt.Errorf("微信回调消费,订单不存在,StockCreatorMchid:%s,StockID:%s,CouponID:%s,TransactionID:%s,CreateTime:%s", - req.PlainText.StockCreatorMchid, - req.PlainText.StockID, - req.PlainText.CouponID, - req.PlainText.ConsumeInformation.TransactionID, - req.PlainText.CreateTime, - ) - } - - return nil, err - } - - return order, nil + return nil, fmt.Errorf("订单查询错误 error: %v", err) } return order, nil diff --git a/internal/data/repoimpl/order.go b/internal/data/repoimpl/order.go index 8fa2c54..b42c4e1 100644 --- a/internal/data/repoimpl/order.go +++ b/internal/data/repoimpl/order.go @@ -372,22 +372,6 @@ func (p *OrderRepoImpl) GetByCouponId(ctx context.Context, merchantNo, batchNo, return p.ToBo(info), nil } -func (this *OrderRepoImpl) GetByTransactionId(ctx context.Context, stockCreatorMchId, stockID, transactionId string) (*bo.OrderBo, error) { - row := &model.Order{} - - tx := this.DB(ctx).Where(model.Order{MerchantNo: stockCreatorMchId, BatchNo: stockID, TransactionId: transactionId}).First(&row) - - if tx.Error != nil { - return nil, tx.Error - } - - if tx.RowsAffected == 0 { - return nil, gorm.ErrRecordNotFound - } - - return this.ToBo(row), nil -} - func (p *OrderRepoImpl) Ing(ctx context.Context, id uint64) error { now := time.Now()