package watch import ( "encoding/json" "errors" "eta/mysteel_watch/global" "eta/mysteel_watch/models/index" ) // GetNoMergeIndexByFrequencyCount 获取未合并的指标总数量 func GetIndexCountByFrequencyV2(req GetMaxFileIndexReq) (total float64, err error) { urlStr := "/mysteel_chemical/getIndexCountByFrequency" if global.CONFIG.Serve.EdbLibUrl == `` { err = errors.New("刷新未配置") return } postUrl := global.CONFIG.Serve.EdbLibUrl + urlStr postData, err := json.Marshal(req) if err != nil { return } result, err := HttpPost(postUrl, string(postData), "application/json") if err != nil { return } var resp BaseResponse global.LOG.Info(" GetNoMergeIndexByFrequencyCountV2 Result: " + string(result)) err = json.Unmarshal(result, &resp) if err != nil { return } t, ok := resp.Data.(float64) if ok { total = t } return } // GetNoMergeIndexByFrequencyPage 当下需要合并到excel的指标 func GetIndexLimitByFrequency(frequency string, limit int) (item []index.BaseFromMysteelChemicalIndex, err error) { urlStr := "/mysteel_chemical/getIndexLimitByFrequency" if global.CONFIG.Serve.EdbLibUrl == `` { err = errors.New("刷新未配置") return } postUrl := global.CONFIG.Serve.EdbLibUrl + urlStr postData, err := json.Marshal(GetNoMergeIndexByFrequencyPageReq{ Frequency: frequency, Limit: limit, }) if err != nil { return } result, err := HttpPost(postUrl, string(postData), "application/json") if err != nil { return } var resp IndexesResponse global.LOG.Info(" GetIndexLimitByFrequency Result: " + string(result)) err = json.Unmarshal(result, &resp) if err != nil { return } item = resp.Data return } // GetIndexPageByFrequency 当下需要合并到excel的指标 func GetIndexPageByFrequency(frequency, endDate string, startSize, pageSize int) (item []index.BaseFromMysteelChemicalIndex, err error) { urlStr := "/mysteel_chemical/getIndexPageByFrequency" if global.CONFIG.Serve.EdbLibUrl == `` { err = errors.New("刷新未配置") return } postUrl := global.CONFIG.Serve.EdbLibUrl + urlStr postData, err := json.Marshal(GetNoMergeIndexByFrequencyPageReqV2{ Frequency: frequency, StartSize: startSize, PageSize: pageSize, EndDate: endDate, TerminalCode: global.CONFIG.Serve.TerminalCode, }) if err != nil { return } result, err := HttpPost(postUrl, string(postData), "application/json") if err != nil { return } var resp IndexesResponse //global.LOG.Info(" GetIndexLimitByFrequency Result: " + string(result)) err = json.Unmarshal(result, &resp) if err != nil { return } item = resp.Data return }