ot_app_score.go 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. package router
  2. import (
  3. "go-admin/app/observe/apis"
  4. "go-admin/common/middleware"
  5. "github.com/gin-gonic/gin"
  6. jwt "github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth"
  7. )
  8. func init() {
  9. // routerNoCheckRole = append(routerNoCheckRole, registerAppHealthRouterTest)
  10. routerCheckRole = append(routerCheckRole, registerAppHealthRouter)
  11. }
  12. // 需认证的路由代码
  13. func registerAppHealthRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
  14. api := apis.AppScore{}
  15. r := v1.Group("/apps_score").Use(authMiddleware.MiddlewareFunc()).Use(middleware.AuthCheckRole())
  16. {
  17. r.POST("", api.CalAppsScore)
  18. r.GET("/:app_alias/svr", api.CalAppsScoreByService)
  19. r.GET("/:app_alias/edge", api.CalAppsScoreByEdge)
  20. r.GET("/:app_alias/svrs", api.CalServicesScoreByApp)
  21. }
  22. }
  23. // 无需认证的路由代码
  24. // func registerAppHealthRouterTest(v1 *gin.RouterGroup) {
  25. // api := apis.AppScore{}
  26. // r := v1.Group("/test/apps_score")
  27. // {
  28. // r.POST("", api.CalAppsScore)
  29. // r.GET("/:app_alias/svr", api.CalAppsScoreByService)
  30. // r.GET("/:app_alias/edge", api.CalAppsScoreByEdge)
  31. // r.GET("/:app_alias/svrs", api.CalServicesScoreByApp)
  32. // }
  33. // }