1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- package roadshow
- import (
- "eta/eta_mobile/controllers"
- "eta/eta_mobile/models"
- "eta/eta_mobile/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
- }
|