base_from_ly_classify_controller.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // Package data_manage
  2. // @Author gmy 2024/8/12 14:32:00
  3. package data_manage
  4. import (
  5. "eta/eta_api/controllers"
  6. "eta/eta_api/models"
  7. "eta/eta_api/services/data"
  8. )
  9. type BaseFromLyClassifyController struct {
  10. controllers.BaseAuthController
  11. }
  12. // LyClassifyList
  13. // @Title 包含分类下的指标名称
  14. // @Description 包含分类下的指标名称
  15. // @Success 200 {object} []data_manage.BaseFromLyClassifyAndIndexInfo
  16. // @router /ly/classify/list [get]
  17. func (this *BaseFromLyClassifyController) LyClassifyList() {
  18. br := new(models.BaseResponse).Init()
  19. // 下面段代码能否统一处理???
  20. defer func() {
  21. if br.ErrMsg == "" {
  22. br.IsSendEmail = false
  23. }
  24. this.Data["json"] = br
  25. this.ServeJSON()
  26. }()
  27. sysUser := this.SysUser
  28. if sysUser == nil {
  29. br.Msg = "请登录"
  30. br.ErrMsg = "请登录,SysUser Is Empty"
  31. br.Ret = 408
  32. return
  33. }
  34. // 获取分类列表
  35. lyClassifyList, err := data.LyClassifyList()
  36. if err != nil {
  37. br.Msg = "获取分类列表失败"
  38. br.ErrMsg = "获取分类列表失败,Err:" + err.Error()
  39. return
  40. }
  41. br.Data = lyClassifyList
  42. br.Ret = 200
  43. br.Success = true
  44. br.Msg = "获取成功"
  45. }