切换主体
This commit is contained in:
parent
0ddde21287
commit
813dfe5ef0
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue