147 lines
4.0 KiB
Go
147 lines
4.0 KiB
Go
package router
|
|
|
|
import (
|
|
api2 "SciencesServer/app/api/enterprise/api"
|
|
"SciencesServer/app/api/manage/api"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
// registerAPI 注册API
|
|
func registerAPI(app *gin.Engine) {
|
|
apiPrefix := "/api"
|
|
g := app.Group(apiPrefix)
|
|
// 登录验证
|
|
g.Use(NeedLogin(AddSkipperURL([]string{
|
|
apiPrefix + "/captcha",
|
|
apiPrefix + "/account/login",
|
|
apiPrefix + "/account/logout",
|
|
}...)))
|
|
// 权限验证
|
|
//g.Use(NeedPermission(AddSkipperURL([]string{
|
|
// apiPrefix + "/captcha",
|
|
// apiPrefix + "/account/login",
|
|
// apiPrefix + "/account/logout",
|
|
//}...)))
|
|
// Captcha 验证码
|
|
g.GET("/captcha", new(api.Captcha).Captcha)
|
|
// Upload 上传管理
|
|
g.POST("/upload", new(api.Upload).Upload)
|
|
// Account 账户管理
|
|
account := g.Group("/account")
|
|
{
|
|
_api := new(api.Account)
|
|
account.POST("/login", _api.Login)
|
|
account.POST("/logout", _api.Logout)
|
|
}
|
|
// User 用户管理
|
|
user := g.Group("/user")
|
|
{
|
|
_api := new(api.User)
|
|
user.GET("/info", _api.Info)
|
|
user.GET("/menu", _api.Menu)
|
|
user.POST("/list", _api.List)
|
|
user.POST("/add", _api.Add)
|
|
user.POST("/edit", _api.Edit)
|
|
user.POST("/delete", _api.Delete)
|
|
user.POST("/edit/password", _api.EditPassword)
|
|
user.POST("/password/quick", _api.QuickPassword)
|
|
user.POST("/role", _api.Role)
|
|
user.POST("/role/bind", _api.RoleBind)
|
|
}
|
|
// Tenant 租户管理
|
|
tenant := g.Group("/tenant")
|
|
{
|
|
_api := new(api.Tenant)
|
|
tenant.POST("/list", _api.List)
|
|
tenant.POST("/add", _api.Add)
|
|
tenant.POST("/edit", _api.Edit)
|
|
tenant.POST("/edit/password", _api.EditPassword)
|
|
tenant.POST("/detail", _api.Detail)
|
|
tenant.POST("/renewal", _api.Renewal)
|
|
tenant.POST("/start_up", _api.StartUp)
|
|
tenant.POST("/disable", _api.Disable)
|
|
tenant.POST("/member/bind", _api.MemberBind)
|
|
tenant.POST("/menu", _api.Menu)
|
|
tenant.POST("/menu/bind", _api.MenuBind)
|
|
tenant.POST("/auth/bind", _api.AuthBind)
|
|
}
|
|
// Menu 菜单管理
|
|
menu := g.Group("/menu")
|
|
{
|
|
_api := new(api.Menu)
|
|
menu.GET("/list", _api.List)
|
|
menu.POST("/add", _api.Add)
|
|
menu.POST("/edit", _api.Edit)
|
|
menu.POST("/status", _api.Status)
|
|
menu.POST("/delete", _api.Delete)
|
|
}
|
|
// Auth 权限管理
|
|
auth := g.Group("/auth")
|
|
{
|
|
_api := new(api.Auth)
|
|
auth.POST("/list", _api.List)
|
|
}
|
|
// Department 部门管理
|
|
department := g.Group("/department")
|
|
{
|
|
_api := new(api.Department)
|
|
department.GET("/list", _api.List)
|
|
department.GET("/select", _api.Select)
|
|
department.POST("/add", _api.Add)
|
|
department.POST("/edit", _api.Edit)
|
|
department.POST("/delete", _api.Delete)
|
|
}
|
|
// Role 角色管理
|
|
role := g.Group("/role")
|
|
{
|
|
_api := new(api.Role)
|
|
role.POST("/list", _api.List)
|
|
role.POST("/select", _api.Select)
|
|
role.POST("/add", _api.Add)
|
|
role.POST("/edit", _api.Edit)
|
|
role.POST("/status", _api.Status)
|
|
role.POST("/delete", _api.Delete)
|
|
role.POST("/menu", _api.Menu)
|
|
role.POST("/menu/bind", _api.MenuBind)
|
|
role.POST("/auth", _api.Auth)
|
|
role.POST("/auth/bind", _api.AuthBind)
|
|
}
|
|
// Logs 日志管理
|
|
log := g.Group("/log")
|
|
{
|
|
_api := new(api.Log)
|
|
log.POST("/login", _api.Login)
|
|
}
|
|
}
|
|
|
|
// registerEnterpriseAPI 注册企业/管家后台API
|
|
func registerEnterpriseAPI(app *gin.Engine) {
|
|
apiPrefix := "/enterprise"
|
|
g := app.Group(apiPrefix)
|
|
// Config 配置管理
|
|
config := g.Group("/config")
|
|
{
|
|
_api := new(api2.Config)
|
|
config.GET("/area", _api.Area)
|
|
}
|
|
// Technology 技术管理
|
|
technology := g.Group("/technology")
|
|
{
|
|
_api := new(api2.Technology)
|
|
technology.POST("/paper", _api.Paper)
|
|
technology.POST("/paper/add", _api.PaperAdd)
|
|
technology.POST("/paper/edit", _api.PaperEdit)
|
|
technology.POST("/paper/delete", _api.PaperDelete)
|
|
technology.POST("/patent", _api.Patent)
|
|
technology.POST("/patent/detail", _api.PatentDetail)
|
|
technology.POST("/patent/add", _api.PatentAdd)
|
|
technology.POST("/patent/edit", _api.PatentEdit)
|
|
technology.POST("/patent/delete", _api.PatentDelete)
|
|
technology.POST("/demand", _api.Demand)
|
|
technology.POST("/demand/detail", _api.DemandDetail)
|
|
technology.POST("/demand/add", _api.DemandAdd)
|
|
technology.POST("/demand/edit", _api.DemandEdit)
|
|
technology.POST("/demand/delete", _api.DemandDelete)
|
|
}
|
|
}
|