From 53a323cae4b2b37faf7f52166e70353b43857f2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=AD=90=E9=93=AD?= Date: Sat, 8 Mar 2025 16:23:25 +0800 Subject: [PATCH] cmb --- internal/biz/wechat_notify_consume.go | 3 +++ 1 file changed, 3 insertions(+) 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