package controllers import ( "hongze/hongze_clpt/models" "hongze/hongze_clpt/utils" "strconv" ) // 品种 type ChartPermissionController struct { BaseCommonController } type ChartPermissionAuthController struct { BaseAuthController } type MobileChartPermissionAuthController struct { BaseAuthMobileController } // @Title 获取所有品种 // @Description 获取所有品种接口 // @Success 200 {object} models.ChartPermissionListResp // @router /list [get] func (this *ChartPermissionController) Detail() { br := new(models.BaseResponse).Init() defer func() { this.Data["json"] = br this.ServeJSON() }() var condition string var chartPermissionId string chartPermissionId = strconv.Itoa(utils.YI_YAO_ID) + "," + strconv.Itoa(utils.XIAO_FEI_ID) + "," + strconv.Itoa(utils.KE_JI_ID) + "," + strconv.Itoa(utils.ZHI_ZAO_ID) + "," + strconv.Itoa(utils.CHART_PERMISSION_ID_YANXUAN) condition += ` AND chart_permission_id IN ( ` + chartPermissionId + `)` list, err := models.GetChartPermissionReportAll(condition) if err != nil { br.Msg = "获取信息失败" br.ErrMsg = "获取品种信息失败,Err:" + err.Error() return } resp := new(models.ChartPermissionListResp) for _, v := range list { if v.PermissionName == utils.CHART_PERMISSION_NAME_MF_YANXUAN { v.PermissionName = utils.MAI_FANG_YAN_XUAN_NAME } } resp.List = list br.Ret = 200 br.Success = true br.Msg = "获取成功" br.Data = resp } // @Title 获取报告所有品种 // @Description 获取报告所有品种接口 // @Success 200 {object} models.ChartPermissionListResp // @router /listByReport [get] func (this *ChartPermissionController) ListByReport() { br := new(models.BaseResponse).Init() defer func() { this.Data["json"] = br this.ServeJSON() }() var condition string //var chartPermissionId string //chartPermissionId = strconv.Itoa(utils.YI_YAO_ID) + "," + strconv.Itoa(utils.XIAO_FEI_ID) + "," + strconv.Itoa(utils.KE_JI_ID) + "," + strconv.Itoa(utils.ZHI_ZAO_ID) + "," + strconv.Itoa(utils.CE_LUE_ID) + "," + strconv.Itoa(utils.GU_SHOU_ID_CHART) //condition += ` AND chart_permission_id IN ( ` + chartPermissionId + `)` condition += ` AND permission_name IN ('医药','消费','科技','智造','策略','固收','周期') ` list, err := models.GetChartPermissionReportAll(condition) if err != nil { br.Msg = "获取信息失败" br.ErrMsg = "获取品种信息失败,Err:" + err.Error() return } //item := new(models.ChartPermissionResp) //item.PermissionName = utils.GU_SHOU_NAME //item.ChartPermissionId = utils.GU_SHOU_ID //list = append(list, item) resp := new(models.ChartPermissionListResp) resp.List = list br.Ret = 200 br.Success = true br.Msg = "获取成功" br.Data = resp } // @Title 获取活动所有品种 // @Description 获取活动所有品种接口 // @Success 200 {object} models.ChartPermissionListResp // @router /listByActivity [get] func (this *MobileChartPermissionAuthController) ListByActivity() { br := new(models.BaseResponse).Init() defer func() { this.Data["json"] = br this.ServeJSON() }() user := this.User if user == nil { br.Msg = "请重新登录" br.Ret = 408 return } var condition string //var chartPermissionId string //chartPermissionId = strconv.Itoa(utils.YI_YAO_ID) + "," + strconv.Itoa(utils.XIAO_FEI_ID) + "," + strconv.Itoa(utils.KE_JI_ID) + "," + strconv.Itoa(utils.ZHI_ZAO_ID) + "," + strconv.Itoa(utils.CE_LUE_ID) + "," + strconv.Itoa(utils.CHART_PERMISSION_ID_YANXUAN) + "," + strconv.Itoa(utils.GU_SHOU_ID_CHART) //condition += ` AND chart_permission_id IN ( ` + chartPermissionId + `)` condition += ` AND permission_name IN ('医药','消费','科技','智造','策略','固收','研选订阅','周期') ` list, err := models.GetChartPermissionReportAll(condition) if err != nil { br.Msg = "获取信息失败" br.ErrMsg = "获取品种信息失败,Err:" + err.Error() return } for _, v := range list { if v.PermissionName == utils.CHART_PERMISSION_NAME_MF_YANXUAN { v.PermissionName = utils.MAI_FANG_YAN_XUAN_NAME } } resp := new(models.ChartPermissionListResp) if user.CompanyId > 1 { chartList, err := models.GetUserCompanyPermissionSand(user.CompanyId) if err != nil && err.Error() != utils.ErrNoRow() { br.Msg = "获取信息失败" br.ErrMsg = "获取品种信息失败,Err:" + err.Error() return } for _, v := range chartList { resp.CheckList = append(resp.CheckList, v.ChartPermissionId) } } resp.List = list br.Ret = 200 br.Success = true br.Msg = "获取成功" br.Data = resp } // @Title 获取报告医药、消费、科技、智造、策略权限列表(没有买方研选) // @Description 获取报告医药、消费、科技、智造、策略权限列表(没有买方研选) // @Success 200 {object} models.ChartPermissionResp // @router /noyx [get] func (this *MobileChartPermissionAuthController) Noyx() { br := new(models.BaseResponse).Init() defer func() { this.Data["json"] = br this.ServeJSON() }() user := this.User if user == nil { br.Msg = "请重新登录" br.Ret = 408 return } var condition string condition += ` AND permission_name IN ('医药','消费','科技','智造','策略','固收','周期') ` list, err := models.GetChartPermissionReportAll(condition) if err != nil { br.Msg = "获取信息失败" br.ErrMsg = "获取品种信息失败,Err:" + err.Error() return } resp := new(models.ChartPermissionListResp) resp.List = list br.Ret = 200 br.Success = true br.Msg = "获取成功" br.Data = resp }