切换主体

This commit is contained in:
ziming 2026-03-26 14:09:15 +08:00
parent 2e364f0332
commit c77e23af8a
1 changed files with 6 additions and 0 deletions

View File

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