refactor🎨: 修改错误信息提示
This commit is contained in:
1 parent
f80e64688e
commit
dd5f0c52fb
15 files changed
+92
-76
No files matched your search
@@ -1,6 +1,7 @@
|
||||
package router
|
||||
|
||||
import (
|
||||
"github.com/go-admin-team/go-admin-core/sdk/config"
|
||||
"go-admin/app/admin/apis"
|
||||
"mime"
|
||||
|
||||
@@ -21,7 +22,9 @@ func InitSysRouter(r *gin.Engine, authMiddleware *jwt.GinJWTMiddleware) *gin.Rou
|
||||
// 静态文件
|
||||
sysStaticFileRouter(g)
|
||||
// swagger;注意:生产环境可以注释掉
|
||||
sysSwaggerRouter(g)
|
||||
if config.ApplicationConfig.Mode != "prod" {
|
||||
sysSwaggerRouter(g)
|
||||
}
|
||||
// 需要认证
|
||||
sysCheckRoleRouterInit(g, authMiddleware)
|
||||
return g
|
||||
@@ -33,7 +36,9 @@ func sysBaseRouter(r *gin.RouterGroup) {
|
||||
go ws.WebsocketManager.SendService()
|
||||
go ws.WebsocketManager.SendAllService()
|
||||
|
||||
r.GET("/", apis.HelloWorld)
|
||||
if config.ApplicationConfig.Mode != "prod" {
|
||||
r.GET("/", apis.GoAdmin)
|
||||
}
|
||||
r.GET("/info", handler.Ping)
|
||||
}
|
||||
|
||||
@@ -43,7 +48,9 @@ func sysStaticFileRouter(r *gin.RouterGroup) {
|
||||
return
|
||||
}
|
||||
r.Static("/static", "./static")
|
||||
r.Static("/form-generator", "./static/form-generator")
|
||||
if config.ApplicationConfig.Mode != "prod" {
|
||||
r.Static("/form-generator", "./static/form-generator")
|
||||
}
|
||||
}
|
||||
|
||||
func sysSwaggerRouter(r *gin.RouterGroup) {
|
||||
@@ -51,16 +58,19 @@ func sysSwaggerRouter(r *gin.RouterGroup) {
|
||||
}
|
||||
|
||||
func sysCheckRoleRouterInit(r *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
|
||||
r.Group("").Use(authMiddleware.MiddlewareFunc()).GET("/ws/:id/:channel", ws.WebsocketManager.WsClient)
|
||||
r.Group("").Use(authMiddleware.MiddlewareFunc()).GET("/wslogout/:id/:channel", ws.WebsocketManager.UnWsClient)
|
||||
v1 := r.Group("/api/v1")
|
||||
wss:=r.Group("").Use(authMiddleware.MiddlewareFunc())
|
||||
{
|
||||
wss.GET("/ws/:id/:channel", ws.WebsocketManager.WsClient)
|
||||
wss.GET("/wslogout/:id/:channel", ws.WebsocketManager.UnWsClient)
|
||||
}
|
||||
|
||||
v1.POST("/login", authMiddleware.LoginHandler)
|
||||
// Refresh time can be longer than token timeout
|
||||
v1.GET("/refresh_token", authMiddleware.RefreshHandler)
|
||||
//registerPageRouter(v1, authMiddleware)
|
||||
v1 := r.Group("/api/v1")
|
||||
{
|
||||
v1.POST("/login", authMiddleware.LoginHandler)
|
||||
// Refresh time can be longer than token timeout
|
||||
v1.GET("/refresh_token", authMiddleware.RefreshHandler)
|
||||
}
|
||||
registerBaseRouter(v1, authMiddleware)
|
||||
//registerDictRouter(v1, authMiddleware)
|
||||
}
|
||||
|
||||
func registerBaseRouter(v1 *gin.RouterGroup, authMiddleware *jwt.GinJWTMiddleware) {
|
||||
|
||||
Reference in new issue
Block a user