From 855156374e63d8af07a6d3683a30c914a8f45b2b Mon Sep 17 00:00:00 2001 From: fuzhongyun <15339891972@163.com> Date: Mon, 26 Jan 2026 09:23:53 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=B7=B3=E8=BF=87=E5=93=8D=E5=BA=94?= =?UTF-8?q?=E5=8C=85=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/pkg/util/json.go | 4 ++++ internal/server/router/router.go | 6 ++++++ internal/services/callback.go | 2 ++ 3 files changed, 12 insertions(+) diff --git a/internal/pkg/util/json.go b/internal/pkg/util/json.go index 2d68184..d668e64 100644 --- a/internal/pkg/util/json.go +++ b/internal/pkg/util/json.go @@ -28,6 +28,10 @@ func (ft *FlexibleType) UnmarshalJSON(data []byte) error { } func (ft FlexibleType) Int() int { + if ft == "" { + return 0 + } + i, _ := strconv.Atoi(string(ft)) return i } diff --git a/internal/server/router/router.go b/internal/server/router/router.go index e334a36..2e5fda2 100644 --- a/internal/server/router/router.go +++ b/internal/server/router/router.go @@ -158,6 +158,12 @@ func registerCommon(c *fiber.Ctx, err error) error { } var data interface{} json.Unmarshal(c.Response().Body(), &data) + + // 检查是否需要跳过响应包装 + if c.Locals("skip_response_wrap") == true { + return c.JSON(data) + } + return c.JSON(fiber.Map{ "data": data, "message": errors.Success.Error(), diff --git a/internal/services/callback.go b/internal/services/callback.go index 1626beb..8a577d8 100644 --- a/internal/services/callback.go +++ b/internal/services/callback.go @@ -606,6 +606,8 @@ func (s *CallbackService) CallbackDingtalkCard(c *fiber.Ctx) error { } } + // 跳过响应包装 + c.Locals("skip_response_wrap", true) return c.JSON(resp) }