package services import ( "eta/eta_data_push/models" "eta/eta_data_push/utils" "github.com/rdlucklib/rdluck_tools/paging" ) func GetIndexList(source int, startDate, endDate string) (list interface{}, err error) { switch source { case utils.DATA_SOURCE_ZZ: list, err = models.GetTradeZhengzhouIndex(startDate, endDate) case utils.DATA_SOURCE_DL: list, err = models.GetTradeDalianIndex(startDate, endDate) case utils.DATA_SOURCE_SH: list, err = models.GetTradeShanghaiIndex(startDate, endDate) case utils.DATA_SOURCE_CFFEX: list, err = models.GetTradeCffexIndex(startDate, endDate) case utils.DATA_SOURCE_SHFE: list, err = models.GetTradeIneIndex(startDate, endDate) case utils.DATA_SOURCE_GOOGLE_TRAVEL: list, err = models.GetChangesVisitorsCovid(startDate, endDate) case utils.DATA_SOURCE_EIA_STEO: list, err = models.GetEiaSteoIndex(startDate, endDate) case utils.DATA_SOURCE_GIE: list, err = models.GetEicIndex(startDate, endDate) case utils.DATA_SOURCE_COM_TRADE: indexList := make([]*models.ComTradeIndex, 0) mappingList := make([]*models.ComTradeCodeMapping, 0) indexList, err = models.GetComTradeIndex(startDate, endDate) if err != nil { return } mappingList, err = models.GetComTradeCodeMappingList(startDate, endDate) if err != nil { return } list = models.ComTradeIndexAndDataResp{ IndexList: indexList, MappingList: mappingList, } case 61: list, err = models.GetMeetingProbabilities(startDate, endDate) case utils.DATA_SOURCE_GFEX: list, err = models.GetBaseFromTradeGuangzhouIndex(startDate, endDate) case utils.DATA_SOURCE_ICPI: list, err = models.GetIcpiIndex(startDate, endDate) case utils.DATA_SOURCE_USDA_FAS: list, err = models.GetUsdaFasIndex(startDate, endDate) default: } return } func GetIndexDataList(source int, indexCode, startDate, endDate string) (list interface{}, err error) { switch source { case utils.DATA_SOURCE_EIA_STEO: list, err = models.GetEiaSteoIndexData(indexCode, startDate, endDate) case utils.DATA_SOURCE_THS: list, err = models.GetEdbDataThs(indexCode, startDate, endDate) case utils.DATA_SOURCE_PB, utils.DATA_SOURCE_PB_FINANCE: list, err = models.GetEdbDataPb(indexCode, startDate, endDate) case utils.DATA_SOURCE_GFEX: //广期所 list, err = models.GetBaseFromTradeGuangzhouData(indexCode, startDate, endDate) case utils.DATA_SOURCE_ICPI: //ICPI消费指数 list, err = models.GetBaseFromIcpiData(indexCode, startDate, endDate) case utils.DATA_SOURCE_USDA_FAS: list, err = models.GetBaseFromUsdaFasData(indexCode, startDate, endDate) default: } return } // GetIndexDataPageList 分页获取数据同步 func GetIndexDataPageList(source, currPage, pageSize int, startDate, endDate string) (list interface{}, err error) { switch source { case utils.DATA_SOURCE_COM_TRADE: var total int dataList := make([]*models.ComTradeData, 0) total, dataList, err = models.GetComTradeDataList(startDate, endDate, currPage*pageSize, pageSize) if err != nil { return } page := paging.GetPaging(currPage, pageSize, total) list = models.ComTradeIndexDataResp{ List: dataList, Paging: page, } case utils.DATA_SOURCE_GFEX: //广期所 var total int dataList := make([]*models.BaseFromTradeGuangzhouData, 0) total, dataList, err = models.GetBaseFromTradeGuangzhouDataList(startDate, endDate, currPage*pageSize, pageSize) if err != nil { return } page := paging.GetPaging(currPage, pageSize, total) list = models.BaseFromTradeGuangzhouDataResp{ List: dataList, Paging: page, } case utils.DATA_SOURCE_ICPI: //ICPI-消费指数 var total int dataList := make([]*models.BaseFromIcpiData, 0) total, dataList, err = models.GetBaseFromIcpiDataList(startDate, endDate, currPage*pageSize, pageSize) if err != nil { return } page := paging.GetPaging(currPage, pageSize, total) list = models.BaseFromIcpiDataResp{ List: dataList, Paging: page, } case utils.DATA_SOURCE_USDA_FAS: //美国农业部 var total int dataList := make([]*models.BaseFromUsdaFasData, 0) total, dataList, err = models.GetBaseFromUsdaFasDataList(startDate, endDate, currPage*pageSize, pageSize) if err != nil { return } page := paging.GetPaging(currPage, pageSize, total) list = models.BaseFromUsdaFasDataResp{ List: dataList, Paging: page, } default: } return }