From 83885990c0b0978a90221c8b78b9fd9914c64f61 Mon Sep 17 00:00:00 2001 From: laodaming <11058467+laudamine@user.noreply.gitee.com> Date: Mon, 6 Nov 2023 15:28:21 +0800 Subject: [PATCH] fix --- server/feishu-sync/internal/handler/webhookhandler.go | 5 +++++ server/feishu-sync/internal/logic/webhooklogic.go | 3 --- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/server/feishu-sync/internal/handler/webhookhandler.go b/server/feishu-sync/internal/handler/webhookhandler.go index cfddae9d..8870982d 100644 --- a/server/feishu-sync/internal/handler/webhookhandler.go +++ b/server/feishu-sync/internal/handler/webhookhandler.go @@ -2,6 +2,8 @@ package handler import ( "encoding/json" + "io" + "log" "net/http" "reflect" @@ -29,6 +31,9 @@ func WebhookHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { w.Write(b) return } + b, _ := io.ReadAll(r.Body) + defer r.Body.Close() + log.Println("收到消息:", string(b)) // 创建一个业务逻辑层实例 l := logic.NewWebhookLogic(r.Context(), svcCtx) diff --git a/server/feishu-sync/internal/logic/webhooklogic.go b/server/feishu-sync/internal/logic/webhooklogic.go index 3e85dedf..df526a6c 100644 --- a/server/feishu-sync/internal/logic/webhooklogic.go +++ b/server/feishu-sync/internal/logic/webhooklogic.go @@ -31,9 +31,6 @@ func NewWebhookLogic(ctx context.Context, svcCtx *svc.ServiceContext) *WebhookLo // } func (l *WebhookLogic) Webhook(req *types.WebhookReq, userinfo *auth.UserInfo) (resp *basic.Response) { - // 返回值必须调用Set重新返回, resp可以空指针调用 resp.SetStatus(basic.CodeOK, data) - // userinfo 传入值时, 一定不为null - return resp.SetStatus(basic.CodeOK) }