码农笔录博客源码
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
506 B

6 years ago
package filter
import (
"github.com/astaxie/beego/context"
6 years ago
"github.com/astaxie/beego/logs"
6 years ago
"beeblog/models"
"encoding/json"
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)
ctx.Output.Header("Access-Control-Allow-Origin","*")
result := models.ReurnError(401, "")
if b,err := json.Marshal(result); err != nil {
ctx.Output.Body(b)
}
return
6 years ago
}
6 years ago
}