123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
- package services
- import (
- "encoding/json"
- "eta/eta_mini_api/models"
- "eta/eta_mini_api/utils"
- "fmt"
- resp2 "eta/eta_mini_api/models/response"
- )
- // GetReportPdfClassify 获取pdf研报的最小分类
- func GetReportPdfClassify(report *models.ReportPdfView) int {
- var res int
- if report.ClassifyIdFirst != 0 {
- res = report.ClassifyIdFirst
- }
- if report.ClassifyIdSecond != 0 {
- res = report.ClassifyIdSecond
- }
- if report.ClassifyIdThird != 0 {
- res = report.ClassifyIdThird
- }
- return res
- }
- func GetReportList(chartPermissionId, level, rangeType, classifyId, currentIndex, pageSize int) (resp *resp2.ReportResp[resp2.ReportList], err error) {
- url := utils.ETA_MINI_BRIDGE_URL + "/report/list?"
- url += fmt.Sprintf("RangeType=%d&ChartPermissionId=%d&Level=%d&PageSize=%d&CurrentIndex=%d&ClassifyId=%d", rangeType, chartPermissionId, level, pageSize, currentIndex, classifyId)
- fmt.Println(url)
- body, err := HttpGet(url)
- if err != nil {
- return
- }
- err = json.Unmarshal(body, &resp)
- if err != nil {
- return
- }
- return
- }
- func GetNoAuthReportList(reportType, chartPermissionId, level, rangeType, classifyId, currentIndex, pageSize int) (resp *resp2.ReportResp[resp2.ReportPushListResp], err error) {
- url := utils.ETA_MINI_BRIDGE_URL + "/noAuth/report/list?"
- url += fmt.Sprintf("ReportType=%d&RangeType=%d&ChartPermissionId=%d&Level=%d&PageSize=%d&CurrentIndex=%d&ClassifyId=%d", reportType, rangeType, chartPermissionId, level, pageSize, currentIndex, classifyId)
- fmt.Println(url)
- body, err := HttpGet(url)
- if err != nil {
- return
- }
- err = json.Unmarshal(body, &resp)
- if err != nil {
- return
- }
- return
- }
- func GetNoAuthReportDetail(reportId int) (resp *resp2.ReportResp[resp2.ReportDetailResp], err error) {
- url := utils.ETA_MINI_BRIDGE_URL + "/noAuth/report/detail?"
- url += fmt.Sprintf("ReportId=%d", reportId)
- fmt.Println(url)
- body, err := HttpGet(url)
- if err != nil {
- return
- }
- err = json.Unmarshal(body, &resp)
- if err != nil {
- return
- }
- return
- }
- func GetReportDetail(reportId, userId int) (resp *resp2.ReportResp[resp2.ReportDetailResp], err error) {
- url := utils.ETA_MINI_BRIDGE_URL + "/report/detail?"
- url += fmt.Sprintf("ReportId=%d&UserId=%d", reportId, userId)
- fmt.Println(url)
- body, err := HttpGet(url)
- if err != nil {
- return
- }
- err = json.Unmarshal(body, &resp)
- if err != nil {
- return
- }
- return
- }
- func GetReportDetailNoUser(reportId int) (resp *resp2.ReportResp[resp2.ReportDetailResp], err error) {
- url := utils.ETA_MINI_BRIDGE_URL + "/report/detail/noUser?"
- url += fmt.Sprintf("ReportId=%d", reportId)
- fmt.Println(url)
- body, err := HttpGet(url)
- if err != nil {
- return
- }
- err = json.Unmarshal(body, &resp)
- if err != nil {
- return
- }
- return
- }
- func GetReportDailyList() (resp *resp2.ReportResp[resp2.ReportList], err error) {
- url := utils.ETA_MINI_BRIDGE_URL + "/report/daily/list"
- fmt.Println(url)
- body, err := HttpGet(url)
- if err != nil {
- return
- }
- err = json.Unmarshal(body, &resp)
- if err != nil {
- return
- }
- return
- }
- func GetReportRecentList(currentIndex, pageSize int) (resp *resp2.ReportResp[resp2.ReportList], err error) {
- url := utils.ETA_MINI_BRIDGE_URL + "/report/recent/list?"
- url += fmt.Sprintf("PageSize=%d&CurrentIndex=%d", pageSize, currentIndex)
- fmt.Println(url)
- body, err := HttpGet(url)
- if err != nil {
- return
- }
- err = json.Unmarshal(body, &resp)
- if err != nil {
- return
- }
- return
- }
- func SearchReport(keyWord string, currentIndex, pageSize int) (resp *resp2.ReportResp[resp2.ReportSearchResp], err error) {
- url := utils.ETA_MINI_BRIDGE_URL + "/report/search?"
- url += fmt.Sprintf("KeyWord=%s&PageSize=%d&CurrentIndex=%d", keyWord, pageSize, currentIndex)
- fmt.Println(url)
- body, err := HttpGet(url)
- if err != nil {
- return
- }
- err = json.Unmarshal(body, &resp)
- if err != nil {
- return
- }
- return
- }
- func SearchReportPush(keyWord string, startSize, pageSize int) (items []*models.ReportPushStatus, total int, err error) {
- if keyWord == "" {
- return
- }
- var pars []interface{}
- condition := `AND title LIKE ?`
- pars = append(pars, utils.GetLikeKeywordPars(pars, keyWord, 1))
- total, err = models.GetReportPushStatusCountByCondition(condition, pars)
- if err != nil {
- return
- }
- items, err = models.GetReportPushStatusByCondition(condition, pars, startSize, pageSize)
- if err != nil {
- return
- }
- return
- }
|