KPI绩效考核系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

98 lines
2.8 KiB

package route
import (
"key_performance_indicators/apirouter"
"key_performance_indicators/identification/interceptor"
"github.com/gin-gonic/gin"
)
// 初始化主路由
func InitialRouter() *gin.Engine {
var router = gin.Default()
//app默认相应
appLoadRouterGroup := router.Group("")
{
// 跨域设置
// router.Use(middleware.CrossDomainRequest()) // 如需跨域可以打开
//app默认相应
appLoadRouterGroup.GET("/", func(c *gin.Context) {
c.JSON(0, "通讯成功!")
})
appLoadRouterGroup.POST("/", func(c *gin.Context) {
c.JSON(0, "通讯成功!")
})
//实验路由
shiyanApi := apirouter.RouterGroupEntry.ShiyanApi
{
shiyanApi.RouterGroup(appLoadRouterGroup)
}
//OAuth 2.0 授权
oAuthEmpowerApi := apirouter.RouterGroupEntry.EmpowerRouter
{
oAuthEmpowerApi.RouterGroup(appLoadRouterGroup)
}
//登录验证
loginVerifyApi := apirouter.RouterGroupEntry.VerifyLogin
{
loginVerifyApi.RouterGroup(appLoadRouterGroup)
}
// 自定义测试
// mytestapi := apirouter.RouterGroupEntry.MyTest
// {
// mytestapi.RouterGroup(appLoadRouterGroup)
// }
}
//验证身份接口 鉴权Url(主要应用端使用)
VerifyIdentity := router.Group("")
VerifyIdentity.Use(interceptor.AuthenticateUser()).Use(interceptor.VerifyUrl())
{
//v1版本接口
//荣誉墙
version1HonorsApi := apirouter.RouterGroupEntry.HonorsSouteRouter
version1HonorsApi.RouterGroup(VerifyIdentity)
//岗位考核
postRouterApi := apirouter.RouterGroupEntry.PostRouter
postRouterApi.RouterGroupPc(VerifyIdentity) //pc端
// postRouterApi.RouterGroupWeb(VerifyIdentity) //web端
//部门考核
departmentRouterApi := apirouter.RouterGroupEntry.DepartmentRouter
departmentRouterApi.RouterGroupPc(VerifyIdentity) //pc端
// departmentRouterApi.RouterGroupWeb(VerifyIdentity) //web端
// 图文信息
bookimgRouterApi := apirouter.RouterGroupEntry.BookImg
bookimgRouterApi.RouterGroup(VerifyIdentity)
//系统授权
systemAuthorizingApi := apirouter.RouterGroupEntry.Empowerouter
systemAuthorizingApi.RouterGroup(VerifyIdentity) //系统授权
}
//验证身份接口 无需鉴权Url(主要web端使用)
VerifyIdentityWeb := router.Group("")
VerifyIdentityWeb.Use(interceptor.AuthenticateUser())
{
//岗位考核
postRouterApiWeb := apirouter.RouterGroupEntry.PostRouter
postRouterApiWeb.RouterGroupWeb(VerifyIdentityWeb) //web端
//部门考核
departmentRouterApiWeb := apirouter.RouterGroupEntry.DepartmentRouter
departmentRouterApiWeb.RouterGroupWeb(VerifyIdentityWeb) //web端
//系统权限设置
systemPowerPcApi := apirouter.RouterGroupEntry.SystemPowerRouter
systemPowerPcApi.RouterGroupPc(VerifyIdentityWeb) //web端
}
//Token身份验证
VerifyIdentityToken := router.Group("")
VerifyIdentityToken.Use(interceptor.IdentificationToken())
{
}
return router
}