package filter import ( "beeblog/models" "encoding/json" "github.com/beego/beego/v2/core/logs" "github.com/beego/beego/v2/server/web/context" ) var LogFilter = func(ctx *context.Context) { logs.Info(ctx.Input.URI()) } var FilterAdmin = func(ctx *context.Context) { if ctx.Input.Session("userid") != nil { ctx.Output.SetStatus(200) ctx.Output.Header("Access-Control-Allow-Origin", "*") result := models.ReurnError(401, "") if b, err := json.Marshal(result); err != nil { ctx.Output.Body(b) } return } }