1、修改路由

This commit is contained in:
wangjian 2023-01-06 17:48:53 +08:00
parent 3532dc294e
commit deaccf048d
1 changed files with 78 additions and 76 deletions

View File

@ -14,10 +14,11 @@ import (
func InitRouter(logger *zap.Logger, engine *xorm.Engine) *gin.Engine {
hs := handler.NewHandlerService(engine, logger)
gin.SetMode(gin.ReleaseMode)
r := gin.New()
r.Use(ginzap.Ginzap(logger, "2006-01-02 15:04:05.000", true))
r.Use(middleware.Cors())
root := gin.New()
root.Use(ginzap.Ginzap(logger, "2006-01-02 15:04:05.000", true))
root.Use(middleware.Cors())
r := root.Group("/api")
{
user := r.Group("/user")
{
user.Use(middleware.JwtAuthMiddleware(logger))
@ -104,5 +105,6 @@ func InitRouter(logger *zap.Logger, engine *xorm.Engine) *gin.Engine {
model.POST("/edit", e.ErrorWrapper(hs.EditModel))
model.POST("/delete", e.ErrorWrapper(hs.DelModel))
}
return r
}
return root
}