Merge branch 'develop' of https://gitee.com/fusenpack/fusenapi into feature/auth

This commit is contained in:
eson
2023-08-08 14:18:45 +08:00
115 changed files with 3189 additions and 504 deletions

View File

@@ -11,22 +11,22 @@ import (
"fusenapi/server/render/internal/types"
)
func ToUnityHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
func GetFaceSliceHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.RequestToUnity
var req types.Request
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
if err != nil {
return
}
// 创建一个业务逻辑层实例
l := logic.NewToUnityLogic(r.Context(), svcCtx)
l := logic.NewGetFaceSliceLogic(r.Context(), svcCtx)
rl := reflect.ValueOf(l)
basic.BeforeLogic(w, r, rl)
resp := l.ToUnity(&req, userinfo)
resp := l.GetFaceSlice(&req, userinfo)
if !basic.AfterLogic(w, r, rl, resp) {
basic.NormalAfterLogic(w, r, resp)

View File

@@ -11,22 +11,22 @@ import (
"fusenapi/server/render/internal/types"
)
func ReadImagesHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
func RenderNotifyHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.RequestReadImages
var req types.RenderNotifyReq
userinfo, err := basic.RequestParse(w, r, svcCtx.SharedState, &req)
if err != nil {
return
}
// 创建一个业务逻辑层实例
l := logic.NewReadImagesLogic(r.Context(), svcCtx)
l := logic.NewRenderNotifyLogic(r.Context(), svcCtx)
rl := reflect.ValueOf(l)
basic.BeforeLogic(w, r, rl)
resp := l.ReadImages(&req, userinfo)
resp := l.RenderNotify(&req, userinfo)
if !basic.AfterLogic(w, r, rl, resp) {
basic.NormalAfterLogic(w, r, resp)

View File

@@ -13,14 +13,14 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodGet,
Path: "/api/render/to-unity",
Handler: ToUnityHandler(serverCtx),
Method: http.MethodPost,
Path: "/api/render/render_notify",
Handler: RenderNotifyHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/api/render/read-images",
Handler: ReadImagesHandler(serverCtx),
Method: http.MethodPost,
Path: "/api/render/get_face_slice",
Handler: GetFaceSliceHandler(serverCtx),
},
},
)