package roadshow import ( "eta/eta_api/controllers" "eta/eta_api/models" "eta/eta_api/models/roadshow" ) // CalendarController 日历 type CalendarController struct { controllers.BaseAuthController } // ResearcherList // @Title 研究员列表 // @Description 研究员列表接口 // @Success 200 {object} roadshow.ResearcherGroup // @router /researcher/list [get] func (this *CalendarController) ResearcherList() { br := new(models.BaseResponse).Init() defer func() { this.Data["json"] = br this.ServeJSON() }() group, err := roadshow.GetResearcherGroup() if err != nil { br.Msg = "获取信息失败!" br.ErrMsg = "获取分组信息失败!Err:" + err.Error() return } researcherList, err := roadshow.GetResearcher() groupMap := make(map[int][]*roadshow.Researcher) for _, v := range researcherList { //if v.RoleTypeCode == "ficc_admin" { // findItems := groupMap[1] // findItems = append(findItems, v) // groupMap[1] = findItems //} else { if findItems, ok := groupMap[v.GroupId]; ok { findItems = append(findItems, v) groupMap[v.GroupId] = findItems } else { findItems = append(findItems, v) groupMap[v.GroupId] = findItems } //} } for _, v := range group { v.ResearcherList = groupMap[v.GroupId] } //allGroup := new(roadshow.ResearcherGroup) //allGroup.GroupId = 99 //allGroup.GroupName = "ficc全体" //group = append(group, allGroup) br.Ret = 200 br.Success = true br.Msg = "获取成功" br.Data = group }