This commit is contained in:
laodaming 2023-11-06 15:28:21 +08:00
parent 21f62035cf
commit 83885990c0
2 changed files with 5 additions and 3 deletions

View File

@ -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)

View File

@ -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)
}