You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
410 B
Go

9 months ago
package controllers
import (
"fmt"
"weather_go/utils"
9 months ago
"github.com/astaxie/beego/context"
)
// 函数功能当访问的url不是login 时就跳转到/login这个url
func FilterUser(ctx *context.Context) {
ok := ctx.Input.Session(utils.GetSessName())
if ok == nil {
ctx.Redirect(302, "/")
fmt.Println("nil")
fmt.Println("未登录或Session已失效")
} else {
fmt.Println("已登录")
}
}