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.
|
|
|
|
package route
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"hr_server/apirouter"
|
|
|
|
|
"hr_server/identification"
|
|
|
|
|
|
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
//初始化主路由
|
|
|
|
|
func InitialRouter() *gin.Engine {
|
|
|
|
|
var router = gin.Default()
|
|
|
|
|
|
|
|
|
|
// 跨域设置
|
|
|
|
|
// router.Use(middleware.CrossDomainRequest()) // 如需跨域可以打开
|
|
|
|
|
|
|
|
|
|
//app默认相应
|
|
|
|
|
appLoadRouterGroup := router.Group("")
|
|
|
|
|
{
|
|
|
|
|
appLoadRouterGroup.GET("/", func(c *gin.Context) {
|
|
|
|
|
c.JSON(0, "通讯成功!")
|
|
|
|
|
})
|
|
|
|
|
appLoadRouterGroup.POST("/test", func(c *gin.Context) {
|
|
|
|
|
c.JSON(0, "通讯成功!")
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//定义路由实例
|
|
|
|
|
|
|
|
|
|
//获取验证信息
|
|
|
|
|
empowerApi := apirouter.RouterGroupInlet.EmpowerApiRouter
|
|
|
|
|
|
|
|
|
|
//实验
|
|
|
|
|
shhiyanApi := apirouter.RouterGroupInlet.ShiyanApiRRouter
|
|
|
|
|
//组织架构
|
|
|
|
|
organizationApi := apirouter.RouterGroupInlet.OrganizationApi //组织架构
|
|
|
|
|
//权限相关操作
|
|
|
|
|
permitPowerApi := apirouter.RouterGroupInlet.PermitPowerApi
|
|
|
|
|
//人员档案
|
|
|
|
|
staffApi := apirouter.RouterGroupInlet.PersonnelRoute
|
|
|
|
|
staffApiFuben := apirouter.RouterGroupInlet.PersonnelRouteKingdee
|
|
|
|
|
|
|
|
|
|
//金蝶对接接口
|
|
|
|
|
jinDieDockingApi := apirouter.RouterGroupInlet.KingdeeApiRouter
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
empowerApi.InitRouterGroup(appLoadRouterGroup) //获取token
|
|
|
|
|
organizationApi.InitRouterGroup(appLoadRouterGroup) //组织架构
|
|
|
|
|
jinDieDockingApi.InitRouterGroup(appLoadRouterGroup) //金蝶对接接口
|
|
|
|
|
|
|
|
|
|
staffApi.InitRouterGroup(appLoadRouterGroup) //人员档案
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//身份验证
|
|
|
|
|
Authentication := router.Group("")
|
|
|
|
|
Authentication.Use(identification.Validator()).Use(identification.Interceptor())
|
|
|
|
|
{
|
|
|
|
|
shhiyanApi.InitRouterGroup(Authentication) //实验
|
|
|
|
|
permitPowerApi.InitRouterGroup(Authentication) //权限相关操作
|
|
|
|
|
staffApiFuben.InitRouterGroup(Authentication) //人员档案
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return router
|
|
|
|
|
}
|