package router import ( "gas-cylinder-api/app/admin/controller" "gas-cylinder-api/common/actions" "github.com/gin-gonic/gin" jwt "gogs.baozhida.cn/zoie/OAuth-core/pkg/jwtauth" ) func init() { routerCheckRole = append(routerCheckRole, registerCustomerRouter) routerNoCheckRole = append(routerNoCheckRole, registerCustomerRouter2) } // 需认证的路由代码 func registerCustomerRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) { cont := controller.CustomerController{} r := v1.Group("/customer").Use(authMiddleware.MiddlewareFunc()).Use(actions.PermissionAction()) { r.GET("", cont.GetPage) //r.GET("/:id", cont.Get) r.GET("/phone", cont.GetByPhone) r.POST("", cont.Insert) r.POST("/insert-or-update", cont.InsertOrUpdate) r.PUT("", cont.Update) r.DELETE("", cont.Delete) r.GET("/borrow-gas-cylinder", cont.GetBorrowGasCylinder) } } func registerCustomerRouter2(v1 *gin.RouterGroup) { cont := controller.CustomerController{} r := v1.Group("/customer") { r.GET("/:id", cont.Get) } }