scrm-go

base_controller.go 1.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package controllers
  2. import (
  3. service "SCRM/service/admin_service"
  4. "SCRM/utils"
  5. "github.com/astaxie/beego"
  6. )
  7. type BaseController struct {
  8. beego.Controller
  9. }
  10. func (this *BaseController) GetAdminUserInfo() *service.AdminUserInfo {
  11. userInfo := this.GetSession("admin_user_info")
  12. if userInfo == nil {
  13. return nil
  14. } else {
  15. return userInfo.(*service.AdminUserInfo)
  16. }
  17. }
  18. func (this *BaseController) ErrorLog(format string, a ...interface{}) {
  19. //beego.Error(fmt.Sprintf(format, a...))
  20. utils.ErrorLog(format, a...)
  21. }
  22. func (this *BaseController) WarnLog(format string, a ...interface{}) {
  23. //beego.Warn(fmt.Sprintf(format, a...))
  24. utils.WarningLog(format, a...)
  25. }
  26. func (this *BaseController) InfoLog(format string, a ...interface{}) {
  27. //beego.Info(fmt.Sprintf(format, a...))
  28. utils.InfoLog(format, a...)
  29. }
  30. func (this *BaseController) DebugLog(format string, a ...interface{}) {
  31. //beego.Debug(fmt.Sprintf(format, a...))
  32. utils.InfoLog(format, a...)
  33. }
  34. func (this *BaseController) TraceLog(format string, a ...interface{}) {
  35. //beego.Trace(fmt.Sprintf(format, a...))
  36. utils.TraceLog(format, a...)
  37. }