切换主体

This commit is contained in:
ziming 2026-03-25 15:50:54 +08:00
parent d34403b012
commit 9c8f64a35a
3 changed files with 16 additions and 4 deletions

View File

@ -25,8 +25,10 @@ func (this *VoucherBiz) RegisterTag(ctx context.Context, id int32) error {
return err
}
if err = this.registerNotifyTag(ctx, stock.MchId, stock.BatchNo); err != nil {
return err
if this.IsNotifyRegisterTag(stock) {
if err = this.registerNotifyTag(ctx, stock.MchId, stock.BatchNo); err != nil {
return err
}
}
_, err = this.ProductRepo.GetByProductNo(ctx, stock.ProductNo)
@ -34,6 +36,15 @@ func (this *VoucherBiz) RegisterTag(ctx context.Context, id int32) error {
return err
}
func (this *VoucherBiz) IsNotifyRegisterTag(product *bo.ProductBo) bool {
for _, subject := range this.bc.WechatSubject {
if subject.MchID == product.MchId {
return false
}
}
return true
}
func (this *VoucherBiz) registerNotifyTag(ctx context.Context, stockCreatorMchID, stockID string) error {
cl := vo.WechatNotifyRegisterTagCacheLockKey.BuildCache([]string{this.bc.WechatNotifyMQ.Tag, stockCreatorMchID, stockID})

View File

@ -46,6 +46,7 @@ func NewHTTPServer(
// https://voucher.86698.cn/voucher/v1/notify/123456 123456为微信主体商户号 正式环境
srv.Route("/voucher/").POST("/v1/notify/{mch_id}", notifyService.Notify)
// ---脚本--
// 订单通知重试 -- 不健全
srv.Route("/voucher/").POST("orderNotifyRetry", cmb.OrderNotifyRetry)
// 重试订单通知,查询微信状态再通知下游招行

View File

@ -54,7 +54,7 @@ func (srv *NotifyService) Notify(ctx http.Context) error {
})
}
log.Warnf("微信回调通知[%s],headers:%+v,body:%s", mchId, headers, string(bodyBytes))
log.Warnf("微信回调通知[%s],数据,headers:%+v,body:%s", mchId, headers, string(bodyBytes))
response, err := srv.WechatBiz.CallBack(ctx, mchId, &headers, bodyBytes)
if err != nil {
@ -68,7 +68,7 @@ func (srv *NotifyService) Notify(ctx http.Context) error {
if err = srv.VoucherBiz.WechatNotifyConsumer(ctx, ip, "WECHAT_NOTIFY", 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{
"code": "FAIL",
"message": err.Error(),