切换主体

This commit is contained in:
ziming 2026-03-26 13:57:09 +08:00
parent 886d140ceb
commit cfe1973bf9
2 changed files with 5 additions and 6 deletions

View File

@ -2,7 +2,9 @@ package biz
import (
"context"
"errors"
"fmt"
"gorm.io/gorm"
errPb "voucher/api/err"
"voucher/internal/biz/bo"
"voucher/internal/biz/vo"
@ -14,6 +16,9 @@ func (this *VoucherBiz) WechatNotifyConsumer(ctx context.Context, ip string, req
// 商品数据量较少,先查询商品是否存在,过滤多余的通知信息
_, err := this.ProductRepo.GetByMchStockId(ctx, req.PlainText.StockCreatorMchid, req.PlainText.StockID)
if err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {
return nil
}
return fmt.Errorf("商品查询错误 error: %w", err)
}

View File

@ -2,11 +2,9 @@ package service
import (
"encoding/json"
"errors"
"fmt"
"github.com/go-kratos/kratos/v2/log"
"github.com/go-kratos/kratos/v2/transport/http"
"gorm.io/gorm"
"io"
http2 "net/http"
"voucher/internal/biz"
@ -75,10 +73,6 @@ func (srv *NotifyService) Notify(ctx http.Context) error {
headerJson, _ := json.Marshal(headers)
log.Errorf("微信回调通知[%s],consumer处理失败:%s\nheaders:%s\nbody:%s\n解析数据:%+v", mchId, err.Error(), headerJson, string(bodyBytes), bizData)
if errors.Is(err, gorm.ErrRecordNotFound) {
return ctx.JSON(http2.StatusOK, nil)
}
return ctx.JSON(http2.StatusBadRequest, map[string]string{
"code": "FAIL",
"message": err.Error(),