diff --git a/internal/biz/wechat_notify.go b/internal/biz/wechat_notify.go index cf19609..ac73bc1 100644 --- a/internal/biz/wechat_notify.go +++ b/internal/biz/wechat_notify.go @@ -9,9 +9,9 @@ import ( "voucher/internal/pkg/lock" ) -func (this *VoucherBiz) WechatNotifyConsumer(ctx context.Context, ip, tag string, req *bo.WechatVoucherNotifyBo) error { +func (this *VoucherBiz) WechatNotifyConsumer(ctx context.Context, ip string, req *bo.WechatVoucherNotifyBo) error { - c := vo.WechatNotifyConsumeLockKey.BuildCache([]string{tag, req.PlainText.StockID, req.PlainText.CouponID}) + c := vo.WechatNotifyConsumeLockKey.BuildCache([]string{req.PlainText.StockCreatorMchid, req.PlainText.StockID, req.PlainText.CouponID}) return lock.NewMutex(this.rdb.Rdb, c.TTL).Lock(ctx, c.Key, func(ctx context.Context) error { @@ -21,7 +21,7 @@ func (this *VoucherBiz) WechatNotifyConsumer(ctx context.Context, ip, tag string } if order.ActivityId != "" { - return this.MultiBiz.Run(ctx, ip, "lsxd_"+req.PlainText.StockCreatorMchid, req, order) + return this.MultiBiz.Run(ctx, ip, req.PlainText.StockCreatorMchid, req, order) } if req.PlainText.Status.IsSended() { diff --git a/internal/service/notify.go b/internal/service/notify.go index a347b71..01dfb5b 100644 --- a/internal/service/notify.go +++ b/internal/service/notify.go @@ -66,7 +66,7 @@ func (srv *NotifyService) Notify(ctx http.Context) error { ip := helper.GetClientIP(ctx) - if err = srv.VoucherBiz.WechatNotifyConsumer(ctx, ip, "WECHAT_NOTIFY", response); err != nil { + if err = srv.VoucherBiz.WechatNotifyConsumer(ctx, ip, response); err != nil { log.Errorf("微信回调通知[%s],处理失败,headers:%+v,body:%s,err:%s", mchId, headers, string(bodyBytes), err.Error()) return ctx.JSON(http2.StatusBadRequest, map[string]string{ diff --git a/internal/service/voucher.go b/internal/service/voucher.go index fddf7d1..07b3211 100644 --- a/internal/service/voucher.go +++ b/internal/service/voucher.go @@ -133,5 +133,5 @@ func (v *VoucherService) WechatUseNotifyConsumer(ctx context.Context, tag, msg s return err } - return v.VoucherBiz.WechatNotifyConsumer(ctx, "127.0.0.1", tag, req) + return v.VoucherBiz.WechatNotifyConsumer(ctx, "127.0.0.1", req) }