最新成果

This commit is contained in:
eson
2023-06-01 16:19:24 +08:00
parent 5446c4123a
commit 7ffbce7759
10 changed files with 241 additions and 20 deletions

View File

@@ -0,0 +1,28 @@
package handler
import (
"net/http"
"fusenapi/home-user-auth/internal/logic"
"fusenapi/home-user-auth/internal/svc"
"fusenapi/home-user-auth/internal/types"
"github.com/zeromicro/go-zero/rest/httpx"
)
func GetTypeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.Request
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := logic.NewGetTypeLogic(r.Context(), svcCtx)
resp, err := l.GetType(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}

View File

@@ -17,6 +17,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
Path: "/user/fonts",
Handler: UserFontsHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/user/get-type",
Handler: GetTypeHandler(serverCtx),
},
},
)
}