init: init refactor
This commit is contained in:
@@ -0,0 +1,168 @@
|
||||
// Code generated by goctl. DO NOT EDIT.
|
||||
// goctl 1.10.1
|
||||
|
||||
package handler
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
client "sundynix-micro-go/app/system/api/internal/handler/client"
|
||||
dict "sundynix-micro-go/app/system/api/internal/handler/dict"
|
||||
menu "sundynix-micro-go/app/system/api/internal/handler/menu"
|
||||
operationRecord "sundynix-micro-go/app/system/api/internal/handler/operationRecord"
|
||||
role "sundynix-micro-go/app/system/api/internal/handler/role"
|
||||
"sundynix-micro-go/app/system/api/internal/svc"
|
||||
|
||||
"github.com/zeromicro/go-zero/rest"
|
||||
)
|
||||
|
||||
func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
||||
server.AddRoutes(
|
||||
[]rest.Route{
|
||||
{
|
||||
// 创建客户端
|
||||
Method: http.MethodPost,
|
||||
Path: "/client/create",
|
||||
Handler: client.CreateClientHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 删除客户端
|
||||
Method: http.MethodDelete,
|
||||
Path: "/client/delete",
|
||||
Handler: client.DeleteClientHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 客户端列表
|
||||
Method: http.MethodPost,
|
||||
Path: "/client/list",
|
||||
Handler: client.GetClientListHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 更新客户端
|
||||
Method: http.MethodPut,
|
||||
Path: "/client/update",
|
||||
Handler: client.UpdateClientHandler(serverCtx),
|
||||
},
|
||||
},
|
||||
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
|
||||
rest.WithPrefix("/api/sys"),
|
||||
)
|
||||
|
||||
server.AddRoutes(
|
||||
[]rest.Route{
|
||||
{
|
||||
// 创建字典
|
||||
Method: http.MethodPost,
|
||||
Path: "/dict/create",
|
||||
Handler: dict.CreateDictHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 删除字典
|
||||
Method: http.MethodDelete,
|
||||
Path: "/dict/delete",
|
||||
Handler: dict.DeleteDictHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 字典列表
|
||||
Method: http.MethodPost,
|
||||
Path: "/dict/list",
|
||||
Handler: dict.GetDictListHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 更新字典
|
||||
Method: http.MethodPut,
|
||||
Path: "/dict/update",
|
||||
Handler: dict.UpdateDictHandler(serverCtx),
|
||||
},
|
||||
},
|
||||
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
|
||||
rest.WithPrefix("/api/sys"),
|
||||
)
|
||||
|
||||
server.AddRoutes(
|
||||
[]rest.Route{
|
||||
{
|
||||
// 根据角色获取菜单
|
||||
Method: http.MethodPost,
|
||||
Path: "/menu/byRole",
|
||||
Handler: menu.GetMenuByRoleHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 创建菜单
|
||||
Method: http.MethodPost,
|
||||
Path: "/menu/create",
|
||||
Handler: menu.CreateMenuHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 删除菜单
|
||||
Method: http.MethodDelete,
|
||||
Path: "/menu/delete",
|
||||
Handler: menu.DeleteMenuHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 菜单列表(树形)
|
||||
Method: http.MethodGet,
|
||||
Path: "/menu/list",
|
||||
Handler: menu.GetMenuListHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 更新菜单
|
||||
Method: http.MethodPut,
|
||||
Path: "/menu/update",
|
||||
Handler: menu.UpdateMenuHandler(serverCtx),
|
||||
},
|
||||
},
|
||||
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
|
||||
rest.WithPrefix("/api/sys"),
|
||||
)
|
||||
|
||||
server.AddRoutes(
|
||||
[]rest.Route{
|
||||
{
|
||||
// 删除操作日志
|
||||
Method: http.MethodDelete,
|
||||
Path: "/log/delete",
|
||||
Handler: operationRecord.DeleteOperationRecordHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 操作日志列表
|
||||
Method: http.MethodPost,
|
||||
Path: "/log/list",
|
||||
Handler: operationRecord.GetOperationRecordListHandler(serverCtx),
|
||||
},
|
||||
},
|
||||
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
|
||||
rest.WithPrefix("/api/sys"),
|
||||
)
|
||||
|
||||
server.AddRoutes(
|
||||
[]rest.Route{
|
||||
{
|
||||
// 创建角色
|
||||
Method: http.MethodPost,
|
||||
Path: "/role/create",
|
||||
Handler: role.CreateRoleHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 删除角色
|
||||
Method: http.MethodDelete,
|
||||
Path: "/role/delete",
|
||||
Handler: role.DeleteRoleHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 角色列表
|
||||
Method: http.MethodPost,
|
||||
Path: "/role/list",
|
||||
Handler: role.GetRoleListHandler(serverCtx),
|
||||
},
|
||||
{
|
||||
// 更新角色
|
||||
Method: http.MethodPut,
|
||||
Path: "/role/update",
|
||||
Handler: role.UpdateRoleHandler(serverCtx),
|
||||
},
|
||||
},
|
||||
rest.WithJwt(serverCtx.Config.Auth.AccessSecret),
|
||||
rest.WithPrefix("/api/sys"),
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user