切换主体
This commit is contained in:
parent
5ba27d7f7b
commit
7c851ddb1b
|
|
@ -9,9 +9,9 @@ import (
|
||||||
"voucher/internal/pkg/lock"
|
"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 {
|
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 != "" {
|
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() {
|
if req.PlainText.Status.IsSended() {
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ func (srv *NotifyService) Notify(ctx http.Context) error {
|
||||||
|
|
||||||
ip := helper.GetClientIP(ctx)
|
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())
|
log.Errorf("微信回调通知[%s],处理失败,headers:%+v,body:%s,err:%s", mchId, headers, string(bodyBytes), err.Error())
|
||||||
return ctx.JSON(http2.StatusBadRequest, map[string]string{
|
return ctx.JSON(http2.StatusBadRequest, map[string]string{
|
||||||
|
|
|
||||||
|
|
@ -133,5 +133,5 @@ func (v *VoucherService) WechatUseNotifyConsumer(ctx context.Context, tag, msg s
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return v.VoucherBiz.WechatNotifyConsumer(ctx, "127.0.0.1", tag, req)
|
return v.VoucherBiz.WechatNotifyConsumer(ctx, "127.0.0.1", req)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue