123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- // Copyright 2019 github.com. All rights reserved.
- // Use of this source code is governed by github.com.
- package route
- import (
- "net/http"
- "github.com/gin-gonic/gin"
- "xingjia-management-gateway/controller/v1"
- "xingjia-management-gateway/route/middleware"
- _ "xingjia-management-gateway/docs"
- )
- func SetupRoute(engine *gin.Engine) {
- // 404页面
- engine.NoRoute(func(c *gin.Context) {
- c.String(http.StatusNotFound, "Not Found")
- })
- // 服务健康检查
- engine.GET("/ping", func(c *gin.Context) {
- // TODO 心跳检查
- c.String(http.StatusOK, "pong")
- })
- //engine.Use(middleware.Session("smart-site-supplier"))
- // version 1
- apiv1 := engine.Group("/api/v1")
- {
- c := v1.NewController()
- engine.POST("/api/v1/user/login", c.Login)
- engine.GET("/api/v1/file", c.DownLoad)
- engine.PUT("/api/v1/token_refresh", c.TokenRefresh)
- apiv1.Use(middleware.Jwt())
- apiv1.POST("/file", c.Upload)
- //apiv1.GET("/file", c.DownLoad)
- //apiv1.PUT("/token_refresh", c.TokenRefresh)
- muser := apiv1.Group("/management_user")
- {
- muser.POST("", c.ManagementUserAdd)
- muser.PUT("/password", c.ManagementUserResetPassword)
- muser.GET("", c.ManagementUserList)
- muser.PUT("", c.ManagementUserUpdate)
- muser.DELETE("", c.ManagementUserDel)
- }
- olog := apiv1.Group("/operation_log")
- {
- olog.GET("", c.OperationLogList)
- olog.DELETE("", c.OperationLogDel)
- }
- jt := apiv1.Group("/jt")
- {
- jt.POST("/desc", c.JtDescAdd)
- jt.GET("/desc", c.JtDescInfo)
- jt.PUT("/desc", c.JtDescUpdate)
- jt.DELETE("/desc", c.JtDescDel)
- jt.PUT("/desc/publish", c.JtDescPublish)
- jt.POST("/vision", c.JtVisionAdd)
- jt.GET("/vision", c.JtVisionInfo)
- jt.PUT("/vision", c.JtVisionUpdate)
- jt.DELETE("/vision", c.JtVisionDel)
- jt.PUT("/vision/publish", c.JtVisionPublish)
- jt.POST("/news", c.JtNewsAdd)
- jt.GET("/news", c.JtNewsList)
- jt.PUT("/news", c.JtNewsUpdate)
- jt.DELETE("/news", c.JtNewsDel)
- jt.PUT("/news/publish", c.JtNewsPublish)
- jt.POST("/announcement", c.JtAnnouncementAdd)
- jt.GET("/announcement", c.JtAnnouncementList)
- jt.PUT("/announcement", c.JtAnnouncementUpdate)
- jt.DELETE("/announcement", c.JtAnnouncementDel)
- jt.PUT("/announcement/publish", c.JtAnnouncementPublish)
- jt.POST("/program", c.JtProgramAdd)
- jt.GET("/program", c.JtProgramList)
- jt.PUT("/program", c.JtProgramUpdate)
- jt.DELETE("/program", c.JtProgramDel)
- jt.PUT("/program/publish", c.JtProgramPublish)
- jt.POST("/lx", c.JtLxAdd)
- jt.GET("/lx", c.JtLxList)
- jt.PUT("/lx", c.JtLxUpdate)
- jt.DELETE("/lx", c.JtLxDel)
- jt.PUT("/lx/publish", c.JtLxPublish)
- jt.POST("/hw", c.JtHwAdd)
- jt.GET("/hw", c.JtHwList)
- jt.PUT("/hw", c.JtHwUpdate)
- jt.DELETE("/hw", c.JtHwDel)
- jt.PUT("/hw/publish", c.JtHwPublish)
- jt.POST("/df", c.JtDfAdd)
- jt.GET("/df", c.JtDfList)
- jt.PUT("/df", c.JtDfUpdate)
- jt.DELETE("/df", c.JtDfDel)
- jt.PUT("/df/publish", c.JtDfPublish)
- jt.POST("/contact", c.JtContactAdd)
- jt.GET("/contact", c.JtContactInfo)
- jt.PUT("/contact", c.JtContactUpdate)
- jt.DELETE("/contact", c.JtContactDel)
- jt.POST("/page_pic", c.PagePicAdd)
- jt.GET("/page_pic", c.PagePicList)
- jt.PUT("/page_pic", c.PagePicUpdate)
- jt.DELETE("/page_pic", c.PagePicDel)
- }
- }
- }
|