控制器与路由绑定
This commit is contained in:
parent
0a502f609e
commit
367a8b88f7
|
@ -0,0 +1,50 @@
|
|||
package infra
|
||||
|
||||
import (
|
||||
"d2-admin-service/src/modules/system/rest"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// InnerRouters 服务内部路由
|
||||
var InnerRouters = map[string]gin.HandlerFunc{}
|
||||
|
||||
func init() {
|
||||
// 用户
|
||||
userApi := rest.UserController{}
|
||||
InnerRouters["pageUser"] = userApi.PageUser
|
||||
InnerRouters["createUser"] = userApi.CreateUser
|
||||
InnerRouters["deleteUser"] = userApi.DeleteUser
|
||||
InnerRouters["modifyUserEmail"] = userApi.ModifyUserEmail
|
||||
InnerRouters["modifyUserPassword"] = userApi.ModifyUserPassword
|
||||
InnerRouters["modifyUserPhone"] = userApi.ModifyUserPhone
|
||||
|
||||
// 角色
|
||||
roleApi := rest.RoleController{}
|
||||
InnerRouters["pageRole"] = roleApi.PageRole
|
||||
InnerRouters["createRole"] = roleApi.CreateRole
|
||||
InnerRouters["deleteRole"] = roleApi.DeleteRole
|
||||
InnerRouters["modifyRoleName"] = roleApi.ModifyRoleName
|
||||
|
||||
// 菜单
|
||||
menuApi := rest.MenuController{}
|
||||
InnerRouters["menus"] = menuApi.TreeMenu
|
||||
InnerRouters["createMenu"] = menuApi.CreateMenu
|
||||
InnerRouters["deleteMenu"] = menuApi.DeleteMenu
|
||||
InnerRouters["modifyMenu"] = menuApi.ModifyMenu
|
||||
|
||||
// api
|
||||
api := rest.ApiController{}
|
||||
InnerRouters["pageApi"] = api.PageApi
|
||||
InnerRouters["registerApi"] = api.RegisterApi
|
||||
InnerRouters["unsubscribeApi"] = api.UnSubscribeApi
|
||||
InnerRouters["modifyApi"] = api.ModifyApi
|
||||
|
||||
// 关联关系
|
||||
authApi := rest.AuthController{}
|
||||
InnerRouters["bindUserRole"] = authApi.BindUserRole
|
||||
InnerRouters["bindRoleMenu"] = authApi.BindRoleMenu
|
||||
InnerRouters["bindApiMenu"] = authApi.BindApiMenu
|
||||
|
||||
// 系统
|
||||
InnerRouters["kickOut"] = authApi.KickOut
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package dao
|
||||
|
||||
import (
|
||||
"d2-admin-service/src/infra/database"
|
||||
"d2-admin-service/src/modules/system/domain"
|
||||
)
|
||||
|
||||
type RouterDao struct {
|
||||
}
|
||||
|
||||
func (RouterDao) GetAllRouter() []domain.Router {
|
||||
var routers []domain.Router
|
||||
// select * from system_router where router_status = 1
|
||||
database.DB.Model(domain.Router{RouterStatus: 1}).Find(&routers)
|
||||
return routers
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
package rest
|
||||
|
||||
import "github.com/gin-gonic/gin"
|
||||
|
||||
type ApiController struct {
|
||||
}
|
||||
|
||||
func (ApiController) PageApi(c *gin.Context) {}
|
||||
func (ApiController) RegisterApi(c *gin.Context) {}
|
||||
func (ApiController) UnSubscribeApi(c *gin.Context) {}
|
||||
func (ApiController) ModifyApi(c *gin.Context) {}
|
|
@ -0,0 +1,11 @@
|
|||
package rest
|
||||
|
||||
import "github.com/gin-gonic/gin"
|
||||
|
||||
type MenuController struct {
|
||||
}
|
||||
|
||||
func (MenuController) TreeMenu(c *gin.Context) {}
|
||||
func (MenuController) CreateMenu(c *gin.Context) {}
|
||||
func (MenuController) DeleteMenu(c *gin.Context) {}
|
||||
func (MenuController) ModifyMenu(c *gin.Context) {}
|
|
@ -0,0 +1,11 @@
|
|||
package rest
|
||||
|
||||
import "github.com/gin-gonic/gin"
|
||||
|
||||
type RoleController struct {
|
||||
}
|
||||
|
||||
func (RoleController) PageRole(c *gin.Context) {}
|
||||
func (RoleController) CreateRole(c *gin.Context) {}
|
||||
func (RoleController) DeleteRole(c *gin.Context) {}
|
||||
func (RoleController) ModifyRoleName(c *gin.Context) {}
|
|
@ -0,0 +1,4 @@
|
|||
package rest
|
||||
|
||||
type RouterController struct {
|
||||
}
|
Loading…
Reference in New Issue