package controllers import ( "wsc-go/service" "github.com/astaxie/beego" ) type BaseController struct { beego.Controller } func (this *BaseController) GetAdminUserInfo() *service.AdminUserInfo { userInfo := this.GetSession("admin_user_info") if userInfo == nil { return nil } else { return userInfo.(*service.AdminUserInfo) } } func (this *BaseController) ErrorLog(format string, a ...interface{}) { //beego.Error(fmt.Sprintf(format, a...)) } func (this *BaseController) WarnLog(format string, a ...interface{}) { //beego.Warn(fmt.Sprintf(format, a...)) } func (this *BaseController) InfoLog(format string, a ...interface{}) { //beego.Info(fmt.Sprintf(format, a...)) } func (this *BaseController) DebugLog(format string, a ...interface{}) { //beego.Debug(fmt.Sprintf(format, a...)) } func (this *BaseController) TraceLog(format string, a ...interface{}) { //beego.Trace(fmt.Sprintf(format, a...)) }