1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- package roadshow
- import (
- "eta/eta_api/controllers"
- "eta/eta_api/models"
- "eta/eta_api/models/roadshow"
- )
- type CalendarController struct {
- controllers.BaseAuthController
- }
- 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 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]
- }
-
-
-
-
- br.Ret = 200
- br.Success = true
- br.Msg = "获取成功"
- br.Data = group
- }
|