package controllers import ( service "SCRM/service/admin_service" "SCRM/utils" "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...)) utils.ErrorLog(format, a...) } func (this *BaseController) WarnLog(format string, a ...interface{}) { //beego.Warn(fmt.Sprintf(format, a...)) utils.WarningLog(format, a...) } func (this *BaseController) InfoLog(format string, a ...interface{}) { //beego.Info(fmt.Sprintf(format, a...)) utils.InfoLog(format, a...) } func (this *BaseController) DebugLog(format string, a ...interface{}) { //beego.Debug(fmt.Sprintf(format, a...)) utils.InfoLog(format, a...) } func (this *BaseController) TraceLog(format string, a ...interface{}) { //beego.Trace(fmt.Sprintf(format, a...)) utils.TraceLog(format, a...) }