beego.go
1.0 KB
package beego
import (
"time"
"github.com/astaxie/beego"
"github.com/linmadan/egglib-go/web/beego/filters"
"gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/constant"
. "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/log"
"gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/port/beego/middleware"
_ "gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/port/beego/routers"
)
func init() {
beego.InsertFilter("/*", beego.BeforeExec, filters.CreateRequestBodyFilter())
//beego.InsertFilter("/*", beego.BeforeExec, filters.CreateRequstLogFilter(Logger))
//beego.InsertFilter("/*", beego.AfterExec, filters.CreateResponseLogFilter(Logger), false)
beego.InsertFilter("/*", beego.BeforeExec, middleware.CreateRequstLogFilter(Logger))
beego.InsertFilter("/*", beego.AfterExec, middleware.CreateResponseLogFilter(Logger), false)
// 默认时区设置
timeLocal, _ := time.LoadLocation("Asia/Chongqing")
time.Local = timeLocal
// 静态文件路径映射
beego.SetStaticPath("/download", "download")
beego.SetStaticPath("/log", constant.LOG_File)
}