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