diff --git a/internal/service/notify.go b/internal/service/notify.go index 956e0c3..c8f7429 100644 --- a/internal/service/notify.go +++ b/internal/service/notify.go @@ -2,9 +2,11 @@ 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" @@ -73,6 +75,10 @@ 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(),