123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- 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
- }
|