Files
x-ui/web/controller/base.go
2021-05-28 17:32:51 +08:00

24 lines
409 B
Go

package controller
import (
"github.com/gin-gonic/gin"
"net/http"
"x-ui/web/session"
)
type BaseController struct {
}
func (a *BaseController) checkLogin(c *gin.Context) {
if !session.IsLogin(c) {
if isAjax(c) {
pureJsonMsg(c, false, "登录时效已过,请重新登录")
} else {
c.Redirect(http.StatusTemporaryRedirect, c.GetString("base_path"))
}
c.Abort()
} else {
c.Next()
}
}