package controller import ( "github.com/astaxie/beego" "github.com/beego/i18n" "github.com/go-xorm/xorm" "server_fhl/dbUtil" ) type baseController struct { beego.Controller x *xorm.Engine i18n.Locale } func (p *baseController) Prepare() { p.x = dbUtil.Engine al := p.Ctx.Request.Header.Get("Accept-Language") if al == "en-US" { p.Lang = al } else { p.Lang = "zh-CN" } }