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.
59 lines
1.3 KiB
59 lines
1.3 KiB
package route
|
|
|
|
import (
|
|
"appPlatform/apirouter"
|
|
"appPlatform/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)
|
|
}
|
|
|
|
}
|
|
|
|
//验证身份接口 鉴权Url(主要应用端使用)
|
|
VerifyIdentity := router.Group("")
|
|
VerifyIdentity.Use(interceptor.AuthenticateUser()).Use(interceptor.VerifyUrl())
|
|
{
|
|
|
|
//主体内容
|
|
version1HonorsApi := apirouter.RouterGroupEntry.UserRouter
|
|
version1HonorsApi.RouterGroupPc(VerifyIdentity)
|
|
|
|
}
|
|
//验证身份接口 无需鉴权Url(主要web端使用)
|
|
VerifyIdentityWeb := router.Group("")
|
|
VerifyIdentityWeb.Use(interceptor.AuthenticateUser())
|
|
{
|
|
|
|
}
|
|
//Token身份验证
|
|
VerifyIdentityToken := router.Group("")
|
|
VerifyIdentityToken.Use(interceptor.IdentificationToken())
|
|
{
|
|
|
|
}
|
|
return router
|
|
}
|
|
|