diff --git a/internal/biz/wechat_notify_consume.go b/internal/biz/wechat_notify_consume.go index e884876..7b13cd5 100644 --- a/internal/biz/wechat_notify_consume.go +++ b/internal/biz/wechat_notify_consume.go @@ -10,6 +10,7 @@ import ( ) func (j *VoucherBiz) WechatNotifyConsumer(ctx context.Context, tag string, req *bo.WechatVoucherNotifyBo) error { + c := vo.WechatNotifyConsumeLockKey.BuildCache([]string{tag, req.PlainText.StockID, req.PlainText.CouponID}) return lock.NewMutex(j.rdb.Rdb, c.TTL).Lock(ctx, c.Key, func(ctx context.Context) error { @@ -46,6 +47,7 @@ func (j *VoucherBiz) WechatNotifyConsumer(ctx context.Context, tag string, req * } func (v *VoucherBiz) wechatVoucherUsed(ctx context.Context, orderWechat *bo.OrderWechatBo) error { + if orderWechat.Status.IsUse() { log.Warnf("券状态已是已使用,忽略不处理,orderNo:%s", orderWechat.OrderNo) return nil @@ -64,6 +66,7 @@ func (v *VoucherBiz) wechatVoucherUsed(ctx context.Context, orderWechat *bo.Orde } func (j *VoucherBiz) wechatVoucherExpired(ctx context.Context, orderWechat *bo.OrderWechatBo) error { + if orderWechat.Status.IsExpired() { log.Warnf("券状态已是已过期,忽略不处理,orderNo:%s", orderWechat.OrderNo) return nil