Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var CheckAdminLogin = func(ctx *context.Context) { token := ctx.Input.Cookie("token") if token == "" { if ctx.Request.RequestURI == "/admin/signin.html" { return } ctx.Redirect(301, "/admin/signin.html") return } admin, err := auth.CheckToken(token) if err != nil || admin.Type != models.USER_TYPE_ADMIN { ctx.Redirect(301, "/admin/signin.html") return } ctx.Input.SetData("isLogin", admin) if ctx.Request.RequestURI == "/admin/signin.html" { ctx.Redirect(301, "/admin/dashboard.html") return } }
CheckAdminLogin 检查后台管理员是否登录
View Source
var CheckOpneAPIAuth = func(ctx *context.Context) { var token string ctx.Input.Bind(&token, "token") if token == "" { ctx.Output.JSON(admin.BizException("缺失token", 600), false, false) return } manager, err := auth.CheckToken(token) if err != nil || manager.Type != models.USER_TYPE_MANAGER { ctx.Output.JSON(admin.BizException("无效token", 600), false, false) return } }
CheckOpneAPIAuth 检查后台openapi权限
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.