This commit is contained in:
李子铭 2025-03-10 11:25:52 +08:00
parent 288d5e7005
commit efd8dd03ec
3 changed files with 4 additions and 4 deletions

View File

@ -54,7 +54,7 @@ func (v *VoucherBiz) CmbQuery(ctx context.Context, orderNo string) (reps *v1.Cmb
err = lock.NewMutex(v.rdb.Rdb, c.TTL).Lock(ctx, c.Key, func(ctx context.Context) error { err = lock.NewMutex(v.rdb.Rdb, c.TTL).Lock(ctx, c.Key, func(ctx context.Context) error {
orderWechat, err := v.OrderWechatRepo.GetByOrderNo(ctx, orderNo) orderWechat, err := v.OrderWechatRepo.GetLastByOrderNo(ctx, orderNo)
if err != nil { if err != nil {
return err return err
} }

View File

@ -10,7 +10,7 @@ type OrderWechatRepo interface {
Success(ctx context.Context, id uint64, couponId string) error Success(ctx context.Context, id uint64, couponId string) error
Fail(ctx context.Context, id uint64, remark string) error Fail(ctx context.Context, id uint64, remark string) error
GetByOutRequestNo(ctx context.Context, outRequestNo string) (*bo.OrderWechatBo, error) GetByOutRequestNo(ctx context.Context, outRequestNo string) (*bo.OrderWechatBo, error)
GetByOrderNo(ctx context.Context, orderNo string) (*bo.OrderWechatBo, error) GetLastByOrderNo(ctx context.Context, orderNo string) (*bo.OrderWechatBo, error)
GetByMSCId(ctx context.Context, mchId, stockId, couponId string) (*bo.OrderWechatBo, error) GetByMSCId(ctx context.Context, mchId, stockId, couponId string) (*bo.OrderWechatBo, error)
Used(ctx context.Context, id uint64) error Used(ctx context.Context, id uint64) error
Expired(ctx context.Context, id uint64) error Expired(ctx context.Context, id uint64) error

View File

@ -85,10 +85,10 @@ func (p *OrderWechatRepoImpl) GetByOutRequestNo(ctx context.Context, outRequestN
return p.ToBo(info), nil return p.ToBo(info), nil
} }
func (p *OrderWechatRepoImpl) GetByOrderNo(ctx context.Context, orderNo string) (*bo.OrderWechatBo, error) { func (p *OrderWechatRepoImpl) GetLastByOrderNo(ctx context.Context, orderNo string) (*bo.OrderWechatBo, error) {
info := &model.OrderWechat{} info := &model.OrderWechat{}
tx := p.DB(ctx).Where(model.OrderWechat{OrderNo: orderNo}).Find(&info) tx := p.DB(ctx).Where(model.OrderWechat{OrderNo: orderNo}).Order("id desc").Find(&info)
if tx.Error != nil { if tx.Error != nil {
return nil, tx.Error return nil, tx.Error