Files
2021-12-27 13:39:17 +08:00

368 lines
11 KiB
Go

package router
import (
api3 "SciencesServer/app/api/enterprise/api"
api1 "SciencesServer/app/api/manage/api"
api2 "SciencesServer/app/api/website/api"
"SciencesServer/app/basic/api"
"SciencesServer/app/session"
"github.com/gin-gonic/gin"
)
// registerAPI 注册API
func registerAPI(app *gin.Engine) {
apiPrefix := "/api"
g := app.Group(apiPrefix)
v1 := g.Group("/v1")
esV1 := v1.Group("/es")
{
_api := new(api2.ES)
esV1.POST("/create", _api.Create)
esV1.POST("/search", _api.Search)
}
// Index 首页信息管理
indexV1 := v1.Group("/index")
{
_api := new(api2.Index)
indexV1.GET("", _api.Instance)
}
// User 用户信息管理
userV1 := v1.Group("/user")
{
_api := new(api2.User)
userV1.POST("/collect/launch", _api.Collect)
}
// Activity 活动信息管理
activityV1 := v1.Group("/activity")
{
_api := new(api2.Activity)
activityV1.POST("", _api.Instance)
activityV1.POST("/detail", _api.Detail)
activityV1.POST("/join", _api.Join)
}
// Sys 平台信息故哪里
sysV1 := v1.Group("/sys")
{
_api := new(api2.Sys)
sysV1.GET("/platform", _api.Platform)
sysV1.GET("/navigation", _api.Navigation)
}
// Docking 对接信息管理
dockingV1 := v1.Group("/docking")
{
_api := new(api2.Docking)
dockingV1.POST("/launch", _api.Launch)
}
// Message 数据信息管理
messageV1 := v1.Group("/message")
{
_api := new(api2.Message)
messageV1.POST("/launch", _api.Launch)
}
// Service 服务信息管理
serviceV1 := v1.Group("/service")
{
_api := new(api2.Service)
serviceV1.GET("/solution_case", _api.SolutionCase)
serviceV1.POST("/solution_case/list", _api.SolutionCaseList)
serviceV1.POST("/solution_case/detail", _api.SolutionCaseDetail)
serviceV1.POST("/innovate", _api.Innovate)
serviceV1.GET("/innovate/kind", _api.InnovateKind)
serviceV1.POST("/innovate/detail", _api.InnovateDetail)
}
// Manage 服务管理
manageV1 := v1.Group("/manage")
{
_api := new(api2.Manage)
manageV1.POST("/search", _api.Search)
manageV1.POST("/company", _api.Company)
manageV1.POST("/company/product", _api.CompanyProduct)
manageV1.POST("/expert", _api.Expert)
manageV1.POST("/expert/achievement", _api.ExpertAchievement)
manageV1.POST("/expert/project", _api.ExpertProject)
manageV1.POST("/expert/patent", _api.ExpertPatent)
manageV1.POST("/expert/paper", _api.ExpertPaper)
manageV1.POST("/expert/cooperate", _api.ExpertCooperate)
manageV1.POST("/expert/cooperate/detail", _api.ExpertCooperateDetail)
manageV1.POST("/laboratory", _api.Laboratory)
manageV1.POST("/laboratory/achievement", _api.LaboratoryAchievement)
manageV1.POST("/laboratory/project", _api.LaboratoryProject)
manageV1.POST("/laboratory/patent", _api.LaboratoryPatent)
manageV1.POST("/laboratory/paper", _api.LaboratoryPaper)
manageV1.POST("/laboratory/cooperate", _api.LaboratoryCooperate)
manageV1.POST("/laboratory/cooperate/detail", _api.LaboratoryCooperateDetail)
manageV1.POST("/laboratory/equipment", _api.LaboratoryEquipment)
}
//Technology 技术信息管理
technologyV1 := v1.Group("/technology")
{
_api := new(api2.Technology)
technologyV1.POST("/patent", _api.Patent)
technologyV1.POST("/patent/detail", _api.PatentDetail)
technologyV1.POST("/demand", _api.Demand)
technologyV1.POST("/demand/detail", _api.DemandDetail)
technologyV1.POST("/achievement", _api.Achievement)
technologyV1.POST("/achievement/detail", _api.AchievementDetail)
}
// About 关于我们管理
aboutV1 := v1.Group("/about")
{
_api := new(api2.About)
aboutV1.POST("", _api.Instance)
aboutV1.GET("/navigation", _api.Navigation)
}
}
// registerAdminAPI 注册API
func registerAdminAPI(app *gin.Engine) {
apiPrefix := "/admin"
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(api1.Captcha).Captcha)
// Upload 上传管理
g.POST("/upload", new(api.Upload).Upload)
// Account 账户管理
account := g.Group("/account")
{
_api := new(api1.Account)
account.POST("/login", _api.Login)
account.POST("/logout", _api.Logout)
}
// User 用户管理
user := g.Group("/user")
{
_api := new(api1.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(api1.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(api1.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(api1.Auth)
auth.POST("/list", _api.List)
}
// Department 部门管理
department := g.Group("/department")
{
_api := new(api1.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(api1.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(api1.Log)
log.POST("/login", _api.Login)
}
}
// registerEnterpriseAPI 注册企业/管家后台API
func registerEnterpriseAPI(app *gin.Engine) {
apiPrefix := "/enterprise"
g := app.Group(apiPrefix)
g.Use(NeedLogin(session.NewEnterprise(), AddSkipperURL([]string{
apiPrefix + "/v1/account/login",
apiPrefix + "/v1/account/register",
apiPrefix + "/v1/account/authorize",
}...)))
v1 := g.Group("/v1")
// Upload 上传管理
v1.POST("/upload", new(api.Upload).Upload)
// Config 配置管理
configV1 := v1.Group("/config")
{
_api := new(api3.Config)
configV1.GET("/area", _api.Area)
configV1.GET("/identity", _api.Identity)
configV1.GET("/industry", _api.Industry)
}
// Account 账号管理
accountV1 := v1.Group("/account")
{
_api := new(api3.Account)
accountV1.POST("/login", _api.Login)
accountV1.POST("/register", _api.Register)
accountV1.POST("/authorize", _api.Authorize)
accountV1.POST("/logout", _api.Logout)
}
// User 用户管理
userV1 := v1.Group("/user")
{
_api := new(api3.User)
userV1.GET("/info", _api.Info)
userV1.GET("/patent", _api.Patent)
}
// Home 首页管理
homeV1 := v1.Group("/home")
{
_api := new(api3.Home)
homeV1.GET("", _api.Instance)
}
// Sys 配置管理
sysV1 := v1.Group("/sys")
{
_api := new(api3.Sys)
sysV1.POST("/patent", _api.Patent)
}
// Settled 入驻管理
settledV1 := v1.Group("/settled")
{
_api := new(api3.Settled)
settledV1.GET("", _api.Index)
settledV1.POST("/company", _api.Company)
settledV1.POST("/company/get", _api.CompanyGet)
settledV1.POST("/expert", _api.Expert)
settledV1.POST("/research", _api.Research)
settledV1.POST("/laboratory", _api.Laboratory)
settledV1.POST("/agent", _api.Agent)
}
// Technology 技术管理
technologyV1 := g.Group("/technology")
{
_api := new(api3.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/visit", _api.ProductVisit)
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)
technologyV1.POST("/achievement", _api.Achievement)
technologyV1.POST("/achievement/add", _api.AchievementAdd)
technologyV1.POST("/achievement/edit", _api.AchievementEdit)
technologyV1.POST("/achievement/shelf", _api.AchievementShelf)
technologyV1.POST("/achievement/delete", _api.AchievementDelete)
}
// Service 服务信息
serviceV1 := v1.Group("/service")
{
_api := new(api3.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(api3.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)
manageV1.POST("/company/detail", _api.CompanyDetail)
manageV1.POST("/company/product", _api.CompanyProduct)
manageV1.POST("/expert", _api.Expert)
manageV1.POST("/research/laboratory", _api.ResearchLaboratory)
manageV1.POST("/research/visit", _api.ResearchVisit)
}
// Activity 活动信息
activityV1 := v1.Group("/activity")
{
_api := new(api3.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)
}
}