微信错误返回body解析报错

This commit is contained in:
李子铭 2025-03-18 14:34:53 +08:00
parent 06f5dd2d5f
commit 1bcd5c768d
1 changed files with 2 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/go-kratos/kratos/v2/log"
"github.com/wechatpay-apiv3/wechatpay-go/core"
"github.com/wechatpay-apiv3/wechatpay-go/services/cashcoupons"
"io"
@ -54,6 +55,7 @@ func (c *CpnRepoImpl) bodyErr(_ context.Context, result *core.APIResult) error {
var errBody ErrBody
if err = json.Unmarshal(bodyBytes, &errBody); err != nil {
log.Errorf("微信错误返回body解析报错,body:%s,err:%s", string(bodyBytes), err.Error())
return err2.ErrorWechatFAIL(fmt.Sprintf("微信错误返回内容解析错误:%s", err.Error()))
}