diff --git a/README.md b/README.md index 0ac8411..48cac1f 100644 --- a/README.md +++ b/README.md @@ -23,3 +23,12 @@ ## 感谢 * 使用在线 mysql 实例 [sqlpub](https://sqlpub.com) + +## 路线图 + +- [ ] 替换 apifox 接口为 jzero 框架接口 + - [ ] /auth/login + - [ ] /auth/getUserInfo + - [ ] /systemManage/getUserList + - [ ] /systemManage/getRoleList + - [ ] /systemManage/getMenuTree \ No newline at end of file diff --git a/server/desc/api/version.api b/server/desc/api/version.api index e5592ee..44f8d98 100644 --- a/server/desc/api/version.api +++ b/server/desc/api/version.api @@ -4,9 +4,9 @@ info ( go_package: "version" ) -type GetVersionRequest {} +type GetRequest {} -type GetVersionResponse { +type GetResponse { version string `json:"version"` goVersion string `json:"goVersion"` commit string `json:"commit"` @@ -18,7 +18,7 @@ type GetVersionResponse { group: version ) service server { - @handler GetVersionHandler - get /version (GetVersionRequest) returns (GetVersionResponse) + @handler GetHandler + get /version (GetRequest) returns (GetResponse) } diff --git a/server/internal/handler/routes.go b/server/internal/handler/routes.go index 3731554..c3f458e 100644 --- a/server/internal/handler/routes.go +++ b/server/internal/handler/routes.go @@ -23,7 +23,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { { Method: http.MethodGet, Path: "/version", - Handler: version.GetVersion(serverCtx), + Handler: version.Get(serverCtx), }, }, rest.WithPrefix("/api/v1"), diff --git a/server/internal/handler/version/getversion.go b/server/internal/handler/version/get.go similarity index 71% rename from server/internal/handler/version/getversion.go rename to server/internal/handler/version/get.go index 7e96c1e..525d28e 100644 --- a/server/internal/handler/version/getversion.go +++ b/server/internal/handler/version/get.go @@ -10,16 +10,16 @@ import ( types "server/internal/types/version" ) -func GetVersion(svcCtx *svc.ServiceContext) http.HandlerFunc { +func Get(svcCtx *svc.ServiceContext) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { - var req types.GetVersionRequest + var req types.GetRequest if err := httpx.Parse(r, &req); err != nil { httpx.ErrorCtx(r.Context(), w, err) return } - l := version.NewGetVersion(r.Context(), svcCtx) - resp, err := l.GetVersion(&req) + l := version.NewGet(r.Context(), svcCtx) + resp, err := l.Get(&req) if err != nil { httpx.ErrorCtx(r.Context(), w, err) } else { diff --git a/server/internal/logic/version/getversion.go b/server/internal/logic/version/get.go similarity index 59% rename from server/internal/logic/version/getversion.go rename to server/internal/logic/version/get.go index cc72cee..a7a1a02 100644 --- a/server/internal/logic/version/getversion.go +++ b/server/internal/logic/version/get.go @@ -3,27 +3,27 @@ package version import ( "context" + "github.com/zeromicro/go-zero/core/logx" + "server/internal/svc" types "server/internal/types/version" - - "github.com/zeromicro/go-zero/core/logx" ) -type GetVersion struct { +type Get struct { logx.Logger ctx context.Context svcCtx *svc.ServiceContext } -func NewGetVersion(ctx context.Context, svcCtx *svc.ServiceContext) *GetVersion { - return &GetVersion{ +func NewGet(ctx context.Context, svcCtx *svc.ServiceContext) *Get { + return &Get{ Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx, } } -func (l *GetVersion) GetVersion(req *types.GetVersionRequest) (resp *types.GetVersionResponse, err error) { +func (l *Get) Get(req *types.GetRequest) (resp *types.GetResponse, err error) { // todo: add your logic here and delete this line return diff --git a/server/internal/types/version/types.go b/server/internal/types/version/types.go index e1db8c6..a1ee263 100644 --- a/server/internal/types/version/types.go +++ b/server/internal/types/version/types.go @@ -9,10 +9,10 @@ var ( _ = time.Now() ) -type GetVersionRequest struct { +type GetRequest struct { } -type GetVersionResponse struct { +type GetResponse struct { Version string `json:"version"` GoVersion string `json:"goVersion"` Commit string `json:"commit"`