tag.go 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. package controllers
  2. import (
  3. "encoding/json"
  4. "hongze/hongze_mfyx/models"
  5. )
  6. type TagController struct {
  7. BaseAuthController
  8. }
  9. // @Title 首页标签列表
  10. // @Description 首页标签列表接口
  11. // @Success 200 {object} cygx.CygxTagListLabelResp
  12. // @router /list/label [get]
  13. func (this *TagController) ListLabel() {
  14. br := new(models.BaseResponse).Init()
  15. defer func() {
  16. this.Data["json"] = br
  17. this.ServeJSON()
  18. }()
  19. sysUser := this.User
  20. if sysUser == nil {
  21. br.Msg = "请登录"
  22. br.ErrMsg = "请登录,SysUser Is Empty"
  23. br.Ret = 408
  24. return
  25. }
  26. //list1 := []string{utils.LABEL_L1_1, utils.LABEL_L1_2, utils.LABEL_L1_3, utils.LABEL_L1_4}
  27. //list2 := []string{utils.LABEL_L2_1, utils.LABEL_L2_2, utils.LABEL_L2_3, utils.LABEL_L2_4}
  28. //
  29. //var list3 = []*models.CygxHashtagReq{}
  30. //item := new(models.CygxHashtagReq)
  31. //item.CheckList = append(item.CheckList, "A")
  32. //item.Hashtag = utils.LABEL_L3_1
  33. //list3 = append(list3, item)
  34. //
  35. //item.Hashtag = utils.LABEL_L3_2
  36. //list3 = append(list3, item)
  37. //
  38. //item.Hashtag = utils.LABEL_L3_3
  39. //list3 = append(list3, item)
  40. resp := new(models.CygxTagListLabelResp)
  41. key := "mfyx_tag_list"
  42. conf, e := models.GetConfigByCode(key)
  43. if e != nil {
  44. br.Msg = "获取失败"
  45. br.ErrMsg = "获取首页头部导航失败, Err: " + e.Error()
  46. return
  47. }
  48. if conf.ConfigValue == "" {
  49. br.Msg = "获取失败"
  50. br.ErrMsg = "首页头部导航配置值有误"
  51. return
  52. }
  53. //list := new(models.HomeHeaderTabList)
  54. if e = json.Unmarshal([]byte(conf.ConfigValue), &resp); e != nil {
  55. br.Msg = "获取失败"
  56. br.ErrMsg = "首页头部导航配置值解析失败, Err: " + e.Error()
  57. return
  58. }
  59. //resp := list.Home
  60. //if searchPage == 1 {
  61. // resp = list.SearchPage
  62. //}
  63. //resp.List1 = list1
  64. //resp.List2 = list2
  65. //resp.List3 = list3
  66. br.Ret = 200
  67. br.Success = true
  68. br.Msg = "获取成功"
  69. br.Data = resp
  70. }