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("已登录")
}