device.go 745 B

1234567891011121314151617181920212223242526
  1. package router
  2. import (
  3. "cold-delivery/app/admin/controller"
  4. "cold-delivery/common/actions"
  5. "github.com/gin-gonic/gin"
  6. jwt "gogs.baozhida.cn/zoie/OAuth-core/pkg/jwtauth"
  7. )
  8. func init() {
  9. routerCheckRole = append(routerCheckRole, registerDeviceRouter)
  10. }
  11. // 需认证的路由代码
  12. func registerDeviceRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
  13. cont := controller.DeviceController{}
  14. r := v1.Group("/device").Use(authMiddleware.MiddlewareFunc()).Use(actions.PermissionAction())
  15. {
  16. r.GET("", cont.GetDevicePage)
  17. }
  18. r2 := v1.Group("/device-sensor").Use(authMiddleware.MiddlewareFunc()).Use(actions.PermissionAction())
  19. {
  20. r2.GET("", cont.GetDeviceSensorPage)
  21. r2.GET("/data", cont.GetDeviceSensorDataPage)
  22. }
  23. }