cmb
This commit is contained in:
parent
288d5e7005
commit
efd8dd03ec
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue