53 lines
1.6 KiB
Go
53 lines
1.6 KiB
Go
package routers
|
|
|
|
import (
|
|
"git.rosy.net.cn/jx-print/controllers"
|
|
router "github.com/chenqinghe/gin-autorouter"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
func Init(r *gin.Engine) {
|
|
v2 := r.Group("/v2")
|
|
//user
|
|
user := v2.Group("/user")
|
|
user.GET("/getTokenInfo", controllers.GetTokenInfo)
|
|
user.POST("/logout", controllers.Logout)
|
|
user.POST("/updateUser", controllers.UpdateUser)
|
|
//app
|
|
app := v2.Group("/app")
|
|
app.GET("/getApps", controllers.GetApps)
|
|
app.POST("/addApp", controllers.AddApp)
|
|
app.POST("/delApp", controllers.DelApp)
|
|
//print
|
|
print := v2.Group("/print")
|
|
print.POST("/addPrinters", controllers.AddPrinters)
|
|
print.GET("/getPrinters", controllers.GetPrinters)
|
|
print.POST("/delPrinters", controllers.DelPrinters)
|
|
print.POST("/updatePrinter", controllers.UpdatePrinter)
|
|
print.POST("/testPrint", controllers.TestPrint)
|
|
print.GET("/getPrintMessages", controllers.GetPrintMessages)
|
|
//order
|
|
order := v2.Group("/order")
|
|
order.POST("/createOrder", controllers.CreateOrder)
|
|
order.POST("/pay", controllers.Pay)
|
|
//sim
|
|
sim := v2.Group("/sim")
|
|
sim.GET("/getCardsInfo", controllers.GetCardsInfo)
|
|
|
|
//v1是不需要token的
|
|
v1 := r.Group("v1")
|
|
userw := v1.Group("/user")
|
|
userw.POST("/login", controllers.Login)
|
|
userw.GET("/refreshCode", controllers.RefreshCode)
|
|
userw.POST("/register", controllers.RegisterUser)
|
|
userw.GET("/getMenus", controllers.GetMenus)
|
|
userw.GET("/getMenuDetail", controllers.GetMenuDetail)
|
|
|
|
//config
|
|
config := v1.Group("/config")
|
|
config.GET("/getConfig", controllers.GetConfig)
|
|
|
|
//自动路由
|
|
r.Any("/callback/*path", router.AutoRoute(&controllers.CallbackController{}))
|
|
}
|