This commit is contained in:
laodaming
2023-10-25 14:27:47 +08:00
parent 91f6970eb0
commit 8dc98d4aca
7 changed files with 20 additions and 173 deletions

View File

@@ -28,15 +28,10 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
Handler: GetCollectProductListHandler(serverCtx),
},
{
Method: http.MethodGet,
Method: http.MethodPost,
Path: "/api/collection/test_ai",
Handler: TestAiHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/api/collection/test_pdf",
Handler: TestPdfHandler(serverCtx),
},
},
)
}

View File

@@ -26,7 +26,7 @@ func TestAiHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
rl := reflect.ValueOf(l)
basic.BeforeLogic(w, r, rl)
resp := l.TestAi(&req, userinfo)
resp := l.TestAi(&req, userinfo, w)
if !basic.AfterLogic(w, r, rl, resp) {
basic.NormalAfterLogic(w, r, resp)

View File

@@ -1,35 +0,0 @@
package handler
import (
"net/http"
"reflect"
"fusenapi/utils/basic"
"fusenapi/server/collection/internal/logic"
"fusenapi/server/collection/internal/svc"
"fusenapi/server/collection/internal/types"
)
func TestPdfHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.TestPdfReq
userinfo, err := basic.RequestParse(w, r, svcCtx, &req)
if err != nil {
return
}
// 创建一个业务逻辑层实例
l := logic.NewTestPdfLogic(r.Context(), svcCtx)
rl := reflect.ValueOf(l)
basic.BeforeLogic(w, r, rl)
resp := l.TestPdf(&req, userinfo)
if !basic.AfterLogic(w, r, rl, resp) {
basic.NormalAfterLogic(w, r, resp)
}
}
}