新设计

This commit is contained in:
eson
2023-05-31 18:33:02 +08:00
parent 12986049ef
commit f7d547de59
14 changed files with 764 additions and 11 deletions

View File

@@ -0,0 +1,22 @@
// Code generated by goctl. DO NOT EDIT.
package handler
import (
"net/http"
"home-user-auth/internal/svc"
"github.com/zeromicro/go-zero/rest"
)
func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodGet,
Path: "/user/fonts",
Handler: UserFontsHandler(serverCtx),
},
},
)
}

View File

@@ -0,0 +1,28 @@
package handler
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"home-user-auth/internal/logic"
"home-user-auth/internal/svc"
"home-user-auth/internal/types"
)
func UserFontsHandler(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.NewUserFontsLogic(r.Context(), svcCtx)
resp, err := l.UserFonts(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}