calendar.go 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. package roadshow
  2. import (
  3. "eta/eta_mobile/controllers"
  4. "eta/eta_mobile/models"
  5. "eta/eta_mobile/models/roadshow"
  6. )
  7. // CalendarController 日历
  8. type CalendarController struct {
  9. controllers.BaseAuthController
  10. }
  11. // ResearcherList
  12. // @Title 研究员列表
  13. // @Description 研究员列表接口
  14. // @Success 200 {object} roadshow.ResearcherGroup
  15. // @router /researcher/list [get]
  16. func (this *CalendarController) ResearcherList() {
  17. br := new(models.BaseResponse).Init()
  18. defer func() {
  19. this.Data["json"] = br
  20. this.ServeJSON()
  21. }()
  22. group, err := roadshow.GetResearcherGroup()
  23. if err != nil {
  24. br.Msg = "获取信息失败!"
  25. br.ErrMsg = "获取分组信息失败!Err:" + err.Error()
  26. return
  27. }
  28. researcherList, err := roadshow.GetResearcher()
  29. groupMap := make(map[int][]*roadshow.Researcher)
  30. for _, v := range researcherList {
  31. //if v.RoleTypeCode == "ficc_admin" {
  32. // findItems := groupMap[1]
  33. // findItems = append(findItems, v)
  34. // groupMap[1] = findItems
  35. //} else {
  36. if findItems, ok := groupMap[v.GroupId]; ok {
  37. findItems = append(findItems, v)
  38. groupMap[v.GroupId] = findItems
  39. } else {
  40. findItems = append(findItems, v)
  41. groupMap[v.GroupId] = findItems
  42. }
  43. //}
  44. }
  45. for _, v := range group {
  46. v.ResearcherList = groupMap[v.GroupId]
  47. }
  48. //allGroup := new(roadshow.ResearcherGroup)
  49. //allGroup.GroupId = 99
  50. //allGroup.GroupName = "ficc全体"
  51. //group = append(group, allGroup)
  52. br.Ret = 200
  53. br.Success = true
  54. br.Msg = "获取成功"
  55. br.Data = group
  56. }