sys_dept.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package router
  2. import (
  3. "gas-cylinder-api/app/admin/controller"
  4. "gas-cylinder-api/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, registerTruckEnterpriseRouter)
  10. routerCheckRole = append(routerCheckRole, registerStoreRouter)
  11. }
  12. // 需认证的路由代码
  13. func registerTruckEnterpriseRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
  14. cont := controller.TruckEnterpriseController{}
  15. r := v1.Group("/truck-enterprise").Use(authMiddleware.MiddlewareFunc()).Use(actions.PermissionAction())
  16. {
  17. r.GET("", cont.GetPage)
  18. r.GET("/:id", cont.Get)
  19. r.POST("", cont.Insert)
  20. r.PUT("", cont.Update)
  21. r.DELETE("", cont.Delete)
  22. r.POST("/enter", cont.Enter)
  23. }
  24. }
  25. // 需认证的路由代码
  26. func registerStoreRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
  27. cont := controller.StoreController{}
  28. r := v1.Group("/store").Use(authMiddleware.MiddlewareFunc()).Use(actions.PermissionAction())
  29. {
  30. r.GET("", cont.GetPage)
  31. r.GET("/delivery", cont.GetDeliveryPage) // 配送门店 当前门店及子门店
  32. r.GET("/:id", cont.Get)
  33. r.POST("", cont.Insert)
  34. r.PUT("", cont.Update)
  35. r.DELETE("", cont.Delete)
  36. r.POST("/enter", cont.Enter)
  37. r.GET("/all", cont.GetAllPage)
  38. r.GET("/all2", cont.GetAllPageByUser)
  39. }
  40. }