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

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package controllers
import (
"fmt"
"weather_go/utils"
"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("已登录")
}
}