test
This commit is contained in:
1 parent
677cdb7821
commit
bc648c3f2f
60 files changed
+2319
-550
No files matched your search
@@ -0,0 +1,25 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"go-admin/app/admin/apis/scol"
|
||||
"go-admin/app/admin/middleware"
|
||||
jwt "go-admin/pkg/jwtauth"
|
||||
)
|
||||
|
||||
func init() {
|
||||
routerCheckRole = append(routerCheckRole, registerScolRouter)
|
||||
}
|
||||
|
||||
// 需认证的路由代码
|
||||
func registerScolRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
|
||||
api := &scol.Scol{}
|
||||
r := v1.Group("/scol").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole())
|
||||
{
|
||||
r.GET("", api.GetScolList)
|
||||
r.GET("/:id", api.GetScol)
|
||||
r.POST("", api.InsertScol)
|
||||
r.PUT("/:id", api.UpdateScol)
|
||||
r.DELETE("", api.DeleteScol)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"go-admin/app/admin/apis/student"
|
||||
"go-admin/app/admin/middleware"
|
||||
jwt "go-admin/pkg/jwtauth"
|
||||
)
|
||||
|
||||
func init() {
|
||||
routerCheckRole = append(routerCheckRole, registerStudentRouter)
|
||||
}
|
||||
|
||||
// 需认证的路由代码
|
||||
func registerStudentRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
|
||||
stu := &student.Student{}
|
||||
r := v1.Group("/student").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole())
|
||||
{
|
||||
r.GET("", stu.GetStudentList)
|
||||
r.GET("/:id", stu.GetStudent)
|
||||
r.POST("", stu.InsertStudent)
|
||||
r.PUT("/:id", stu.UpdateStudent)
|
||||
r.DELETE("", stu.DeleteStudent)
|
||||
}
|
||||
}
|
||||
@@ -25,15 +25,12 @@ func InitSysRouter(r *gin.Engine, authMiddleware *jwt.GinJWTMiddleware) *gin.Rou
|
||||
sysBaseRouter(g)
|
||||
// 静态文件
|
||||
sysStaticFileRouter(g)
|
||||
|
||||
// swagger;注意:生产环境可以注释掉
|
||||
sysSwaggerRouter(g)
|
||||
|
||||
// 无需认证
|
||||
sysNoCheckRoleRouter(g)
|
||||
// 需要认证
|
||||
sysCheckRoleRouterInit(g, authMiddleware)
|
||||
|
||||
return g
|
||||
}
|
||||
|
||||
@@ -44,13 +41,11 @@ func sysBaseRouter(r *gin.RouterGroup) {
|
||||
go ws.WebsocketManager.SendAllService()
|
||||
|
||||
r.GET("/", system.HelloWorld)
|
||||
|
||||
r.GET("/info", handler.Ping)
|
||||
}
|
||||
|
||||
func sysStaticFileRouter(r *gin.RouterGroup) {
|
||||
mime.AddExtensionType(".js", "application/javascript")
|
||||
|
||||
r.Static("/static", "./static")
|
||||
r.Static("/form-generator", "./static/form-generator")
|
||||
}
|
||||
@@ -65,7 +60,7 @@ func sysNoCheckRoleRouter(r *gin.RouterGroup) {
|
||||
v1.GET("/monitor/server", monitor.ServerInfo)
|
||||
v1.GET("/getCaptcha", system.GenerateCaptchaHandler)
|
||||
v1.GET("/gen/preview/:tableId", Preview)
|
||||
v1.GET("/gen/toproject/:tableId", GenCodeV2)
|
||||
v1.GET("/gen/toproject/:tableId", GenCodeV3)
|
||||
v1.GET("/gen/todb/:tableId", GenMenuAndApi)
|
||||
v1.GET("/gen/tabletree", GetSysTablesTree)
|
||||
v1.GET("/menuTreeselect", system.GetMenuTreeelect)
|
||||
|
||||
Reference in new issue
Block a user