package services import ( "encoding/json" "eta/eta_mini_api/models" "eta/eta_mini_api/utils" "fmt" ) // GetChartPermissionSecondList 获取二级品种权限 func GetChartPermissionSecondList(chartPermissionId int) (resp *models.ChartPermissionResp[[]*models.ChartPermission], err error) { url := utils.ETA_MINI_BRIDGE_URL + "/chart_permission/second/list" url += fmt.Sprintf("?chartPermissonId=%d", chartPermissionId) body, err := HttpGet(url) if err != nil { return } err = json.Unmarshal(body, &resp) if err != nil { return } return } // GetChartPermissionList 获取一级品种权限 func GetChartPermissionList() (resp *models.ChartPermissionResp[[]*models.ChartPermission], err error) { url := utils.ETA_MINI_BRIDGE_URL + "/chart_permission/list" body, err := HttpGet(url) if err != nil { return } err = json.Unmarshal(body, &resp) if err != nil { return } return } // GetPublicChartPermissionList 获取公共品种权限列表 func GetPublicChartPermissionList() (resp *models.ChartPermissionResp[[]*models.ChartPermissionTreeView], err error) { url := utils.ETA_MINI_BRIDGE_URL + "/chart_permission/public/list" body, err := HttpGet(url) if err != nil { return } err = json.Unmarshal(body, &resp) if err != nil { return } return } // GetPrivateChartPermissionList 获取私有品种权限列表 func GetPrivateChartPermissionList() (resp *models.ChartPermissionResp[[]*models.ChartPermissionTreeView], err error) { url := utils.ETA_MINI_BRIDGE_URL + "/chart_permission/private/list" body, err := HttpGet(url) if err != nil { return } err = json.Unmarshal(body, &resp) if err != nil { return } return } // GetChartPermissionAllList 获取所有品种权限列表 func GetChartPermissionAllList() (resp *models.ChartPermissionResp[[]*models.ChartPermission], err error) { url := utils.ETA_MINI_BRIDGE_URL + "/chart_permission/allList" body, err := HttpGet(url) if err != nil { return } err = json.Unmarshal(body, &resp) if err != nil { return } return } // GetReportChartPermissionList 获取研报的权限列表 func GetReportChartPermissionList(reportId int) (resp *models.ChartPermissionResp[[]*models.ChartPermission], err error) { url := utils.ETA_MINI_BRIDGE_URL + "/chart_permission/detail" url += fmt.Sprintf("?ReportId=%d", reportId) body, err := HttpGet(url) if err != nil { return } err = json.Unmarshal(body, &resp) if err != nil { return } return } // GetChartPermissionListByClassifyId 根据分类id获取权限列表 scope 0:二级品种权限,1:一级品种权限,2:所有权限 func GetChartPermissionListByClassifyId(classifyId, scope int) (resp *models.ChartPermissionResp[[]*models.ChartPermission], err error) { url := utils.ETA_MINI_BRIDGE_URL + "/chart_permission/classify/detail" url += fmt.Sprintf("?ClassifyId=%d&Scope=%d", classifyId, scope) body, err := HttpGet(url) if err != nil { return } err = json.Unmarshal(body, &resp) if err != nil { return } return } // GetClassifyTreeByChartPermission 获取绑定该品种的分类树 func GetClassifyTreeByChartPermission(chartPermissionId int) (resp *models.ChartPermissionResp[[]*models.ClassifyView], err error) { url := utils.ETA_MINI_BRIDGE_URL + "/chart_permission/classify/tree" url += fmt.Sprintf("?ChartPermissionId=%d", chartPermissionId) body, err := HttpGet(url) if err != nil { return } err = json.Unmarshal(body, &resp) if err != nil { return } return } // GetClassifyListByChartPermission 获取绑定该品种的分类列表 func GetClassifyListByChartPermission(chartPermissionId int) (resp *models.ChartPermissionResp[[]*models.ClassifyView], err error) { url := utils.ETA_MINI_BRIDGE_URL + "/chart_permission/classify/list" url += fmt.Sprintf("?ChartPermissionId=%d", chartPermissionId) body, err := HttpGet(url) if err != nil { return } err = json.Unmarshal(body, &resp) if err != nil { return } return }