fix
This commit is contained in:
parent
8c175ad9cc
commit
deed8bb14c
|
@ -1,7 +1,7 @@
|
||||||
package handler
|
package handler
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
|
@ -14,13 +14,20 @@ import (
|
||||||
|
|
||||||
func TicketWebhookHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
func TicketWebhookHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
return func(w http.ResponseWriter, r *http.Request) {
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
fmt.Println(r.Header)
|
|
||||||
var req types.TicketWebhookReq
|
var req types.TicketWebhookReq
|
||||||
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
|
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
//验证连接
|
||||||
|
if req.Type == "url_verification" {
|
||||||
|
challengeRsp := map[string]string{
|
||||||
|
"challenge": req.Challenge,
|
||||||
|
}
|
||||||
|
b, _ := json.Marshal(challengeRsp)
|
||||||
|
w.Write(b)
|
||||||
|
return
|
||||||
|
}
|
||||||
// 创建一个业务逻辑层实例
|
// 创建一个业务逻辑层实例
|
||||||
l := logic.NewTicketWebhookLogic(r.Context(), svcCtx)
|
l := logic.NewTicketWebhookLogic(r.Context(), svcCtx)
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package logic
|
package logic
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"fusenapi/utils/auth"
|
"fusenapi/utils/auth"
|
||||||
"fusenapi/utils/basic"
|
"fusenapi/utils/basic"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
@ -33,15 +32,7 @@ func NewTicketWebhookLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Tic
|
||||||
// }
|
// }
|
||||||
|
|
||||||
func (l *TicketWebhookLogic) TicketWebhook(req *types.TicketWebhookReq, userinfo *auth.UserInfo, w http.ResponseWriter) (resp *basic.Response) {
|
func (l *TicketWebhookLogic) TicketWebhook(req *types.TicketWebhookReq, userinfo *auth.UserInfo, w http.ResponseWriter) (resp *basic.Response) {
|
||||||
//验证连接
|
|
||||||
if req.Type == "url_verification" {
|
|
||||||
challengeRsp := map[string]string{
|
|
||||||
"challenge": req.Challenge,
|
|
||||||
}
|
|
||||||
b, _ := json.Marshal(challengeRsp)
|
|
||||||
w.Write(b)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
return resp.SetStatusWithMessage(basic.CodeOK, "success")
|
return resp.SetStatusWithMessage(basic.CodeOK, "success")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user