ot_apps.go 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package router
  2. import (
  3. "github.com/gin-gonic/gin"
  4. jwt "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth"
  5. "go-admin/app/admin/apis"
  6. "go-admin/common/actions"
  7. "go-admin/common/middleware"
  8. )
  9. func init() {
  10. routerCheckRole = append(routerCheckRole, registerOtAppsRouter)
  11. routerNoCheckRole = append(routerNoCheckRole, registerOtAppsRouterTest)
  12. }
  13. // registerOtAppsRouter
  14. func registerOtAppsRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
  15. api := apis.OtApps{}
  16. r := v1.Group("/ot-apps").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole())
  17. {
  18. r.GET("", actions.PermissionAction(), api.GetPage)
  19. r.GET("/service/list", api.GetServiceList)
  20. r.GET("/:id", actions.PermissionAction(), api.Get)
  21. r.POST("", api.Insert)
  22. r.PUT("/:id", actions.PermissionAction(), api.Update)
  23. r.DELETE("", api.Delete)
  24. r.POST("/:id/dashboard/add", api.AddDashboard)
  25. }
  26. }
  27. // registerOtAppsRouter
  28. func registerOtAppsRouterTest(v1 *gin.RouterGroup) {
  29. api := apis.OtApps{}
  30. r := v1.Group("/ot-apps/test")
  31. {
  32. r.GET("", api.GetPage)
  33. r.GET("/:id", api.Get)
  34. r.POST("", api.Insert)
  35. r.PUT("/:id", api.Update)
  36. r.DELETE("", api.Delete)
  37. r.POST("/:id/dashboard/add", api.AddDashboard)
  38. }
  39. }