码农笔录博客源码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
526 B

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