Files
2021-12-02 15:23:48 +08:00

238 lines
7.0 KiB
Go

package router
import (
api2 "SciencesServer/app/api/enterprise/api"
"SciencesServer/app/api/manage/api"
api3 "SciencesServer/app/basic/api"
"SciencesServer/app/session"
"github.com/gin-gonic/gin"
)
// registerAPI 注册API
func registerAPI(app *gin.Engine) {
}
// registerManageAPI 注册API
func registerManageAPI(app *gin.Engine) {
apiPrefix := "/manage"
g := app.Group(apiPrefix)
// 登录验证
g.Use(NeedLogin(session.NewManage(), 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(api3.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)
//g.Use(NeedLogin(session.NewManage(), AddSkipperURL([]string{}...)))
v1 := g.Group("/v1")
// Upload 上传管理
v1.POST("/upload", new(api3.Upload).Upload)
// Config 配置管理
configV1 := v1.Group("/config")
{
_api := new(api2.Config)
configV1.GET("/area", _api.Area)
}
// Account 账号管理
accountV1 := v1.Group("/account")
{
_api := new(api2.Account)
accountV1.POST("/login", _api.Login)
accountV1.POST("/register", _api.Register)
accountV1.POST("/authorize", _api.Authorize)
accountV1.POST("/logout", _api.Logout)
}
// Sys 配置管理
sysV1 := v1.Group("/sys")
{
_api := new(api2.Sys)
sysV1.POST("/patent", _api.Patent)
}
// Settled 入驻管理
settledV1 := v1.Group("/settled")
{
_api := new(api2.Settled)
settledV1.GET("", _api.Index)
settledV1.POST("/company", _api.Company)
settledV1.POST("/expert", _api.Expert)
}
// Technology 技术管理
technologyV1 := g.Group("/technology")
{
_api := new(api2.Technology)
technologyV1.POST("/paper", _api.Paper)
technologyV1.POST("/paper/add", _api.PaperAdd)
technologyV1.POST("/paper/edit", _api.PaperEdit)
technologyV1.POST("/paper/delete", _api.PaperDelete)
technologyV1.POST("/patent", _api.Patent)
technologyV1.POST("/patent/detail", _api.PatentDetail)
technologyV1.POST("/patent/add", _api.PatentAdd)
technologyV1.POST("/patent/edit", _api.PatentEdit)
technologyV1.POST("/patent/delete", _api.PatentDelete)
technologyV1.POST("/demand", _api.Demand)
technologyV1.POST("/demand/detail", _api.DemandDetail)
technologyV1.POST("/demand/add", _api.DemandAdd)
technologyV1.POST("/demand/edit", _api.DemandEdit)
technologyV1.POST("/demand/delete", _api.DemandDelete)
technologyV1.POST("/topic", _api.Topic)
technologyV1.POST("/topic/add", _api.TopicAdd)
technologyV1.POST("/topic/edit", _api.TopicEdit)
technologyV1.POST("/topic/delete", _api.TopicDelete)
technologyV1.POST("/product", _api.Product)
technologyV1.POST("/product/add", _api.ProductAdd)
technologyV1.POST("/product/edit", _api.ProductEdit)
technologyV1.POST("/product/shelf", _api.ProductShelf)
technologyV1.POST("/product/delete", _api.ProductDelete)
technologyV1.POST("/project", _api.Project)
technologyV1.POST("/project/add", _api.ProjectAdd)
technologyV1.POST("/project/edit", _api.ProjectEdit)
technologyV1.POST("/project/shelf", _api.ProjectShelf)
technologyV1.POST("/project/delete", _api.ProjectDelete)
}
// Service 服务信息
serviceV1 := v1.Group("/service")
{
_api := new(api2.Service)
serviceV1.POST("/demand", _api.Demand)
serviceV1.POST("/demand/detail", _api.DemandDetail)
serviceV1.POST("/demand/add", _api.DemandAdd)
serviceV1.POST("/demand/edit", _api.DemandEdit)
serviceV1.POST("/demand/delete", _api.DemandDelete)
}
// Manage 管理信息
manageV1 := v1.Group("/manage")
{
_api := new(api2.Manage)
manageV1.POST("/enterprise", _api.Enterprise)
manageV1.POST("/enterprise/add", _api.EnterpriseAdd)
manageV1.POST("/enterprise/edit", _api.EnterpriseEdit)
manageV1.POST("/enterprise/delete", _api.EnterpriseDelete)
manageV1.POST("/equipment", _api.Equipment)
manageV1.POST("/equipment/add", _api.EquipmentAdd)
manageV1.POST("/equipment/edit", _api.EquipmentEdit)
manageV1.POST("/equipment/delete", _api.EquipmentDelete)
}
// Identity 身份信息
identityV1 := v1.Group("/config")
{
_api := new(api2.Identity)
identityV1.POST("/expert", _api.Expert)
}
// Activity 活动信息
activityV1 := v1.Group("/activity")
{
_api := new(api2.Activity)
activityV1.POST("/apply", _api.Applys)
activityV1.POST("/apply/revoke", _api.ApplyRevoke)
activityV1.POST("/apply/delete", _api.ApplyDelete)
activityV1.POST("/joins", _api.Joins)
activityV1.POST("/join/delete", _api.JoinDelete)
}
}