123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- package controllers
- import (
- "eta/eta_api/models"
- "eta/eta_api/services"
- "eta/eta_api/utils"
- )
- type ResearchGroupController struct {
- BaseAuthController
- }
- // GetResearchGroupList
- // @Title 获取研究方向分组列表
- // @Description 获取研究方向分组列表
- // @Success 200 {object} services.ResearchGroupItem 获取成功
- // @router /research_group/list [get]
- func (this *ResearchGroupController) GetResearchGroupList() {
- br := new(models.BaseResponse).Init()
- defer func() {
- this.Data["json"] = br
- this.ServeJSON()
- }()
- if utils.BusinessCode != utils.BusinessCodeRelease && utils.BusinessCode != utils.BusinessCodeSandbox && utils.BusinessCode != utils.BusinessCodeDebug {
- br.Ret = 200
- br.Success = true
- br.Msg = "操作成功"
- return
- }
- include, _ := this.GetInt("Include")
- list, err := services.GetResearchGroupTree(include)
- if err != nil {
- br.Msg = "获取分组失败"
- br.ErrMsg = "GetResearchGroupList ErrMsg:" + err.Error()
- return
- }
- br.Ret = 200
- br.Success = true
- br.Msg = "获取成功"
- br.Data = list
- }
- // GetAdminResearchGroup
- // @Title 获取研究员研究方向
- // @Description 获取研究员研究方向
- // @Param AdminId query int true "研究员ID"
- // @Success 200 {object} models.ResearchGroupRelation 获取成功
- // @router /research_group/admin_group [get]
- func (this *ResearchGroupController) GetAdminResearchGroup() {
- br := new(models.BaseResponse).Init()
- defer func() {
- this.Data["json"] = br
- this.ServeJSON()
- }()
- adminId, _ := this.GetInt("AdminId")
- if adminId == 0 {
- br.Msg = "参数有误"
- return
- }
- if utils.BusinessCode != utils.BusinessCodeRelease && utils.BusinessCode != utils.BusinessCodeSandbox && utils.BusinessCode != utils.BusinessCodeDebug {
- br.Ret = 200
- br.Success = true
- br.Msg = "获取成功"
- return
- }
- //list, err := system.ResearchGroupRelationListByAdminId(adminId)
- list, err := models.ResearchTagRelationListByAdminId(adminId)
- if err != nil {
- br.Msg = "获取研究方向失败"
- br.ErrMsg = "GetAdminResearchGroup ErrMsg:" + err.Error()
- return
- }
- br.Ret = 200
- br.Success = true
- br.Msg = "获取成功"
- br.Data = list
- }
|