ice_raft.go 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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, registerIceRaftRouter)
  10. }
  11. // 需认证的路由代码
  12. func registerIceRaftRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
  13. cont := controller.IceRaftController{}
  14. r := v1.Group("/ice-raft").Use(authMiddleware.MiddlewareFunc()).Use(actions.PermissionAction())
  15. {
  16. r.GET("", cont.GetPage)
  17. r.GET("/newest-record", cont.GetNewestRecordPage)
  18. r.GET("/:id", cont.Get)
  19. r.GET("/code/:code", cont.GetByCode)
  20. r.POST("", cont.Insert)
  21. r.PUT("", cont.Update)
  22. r.DELETE("", cont.Delete)
  23. r.POST("/in-storage", cont.InStorage)
  24. r.POST("/out-storage", cont.OutStorage)
  25. r.GET("/newest-record-sse", cont.GetNewestRecordPageSSE)
  26. r.GET("/cooler-box", cont.GetPageByCoolerBoxId)
  27. }
  28. cont2 := controller.IceRaftRecordController{}
  29. r2 := v1.Group("/ice-raft-record").Use(authMiddleware.MiddlewareFunc()).Use(actions.PermissionAction())
  30. {
  31. r2.GET("", cont2.GetPage)
  32. r2.PUT("", cont2.Update)
  33. r2.DELETE("", cont2.Delete)
  34. }
  35. }