1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378 |
- // Package fenwei
- // @Author gmy 2024/8/20 14:47:00
- package fenwei
- import (
- "encoding/json"
- "eta/eta_data_analysis/models"
- "eta/eta_data_analysis/utils"
- "fmt"
- "strings"
- )
- // ThermalCoalSupplyProcessor 动力煤供应量
- type ThermalCoalSupplyProcessor struct {
- BaseProcessor
- }
- func (p *ThermalCoalSupplyProcessor) GenerateRequestParams(currentTime string) map[string]string {
- params := models.RequestParams{
- Category: nil,
- CheckedDims: map[string][]string{
- "province": {"20", "16", "21", "6", "19", "23", "8", "1", "7", "17", "9", "15", "11", "22", "24", "4", "25", "12", "14", "13", "18", "3", "10", "5", "2", "37"},
- },
- DateRange: "20190820-" + currentTime,
- ProductCode: "FW4002D",
- QuotaName: "monthly_value,monthly_accumulation",
- SplitTypeKey: "province",
- IsTotal: 0,
- DataType: nil,
- IsSeason: 1,
- }
- // 将结构体转换为 JSON 字符串
- paramsJSON, _ := json.Marshal(params)
- // 返回为 map[string]string 类型
- return map[string]string{
- "params": string(paramsJSON),
- }
- }
- func (p *ThermalCoalSupplyProcessor) ProcessResponse(data string) ([]models.FenWeiNetIndexInfo, error) {
- responseData := fillFenWeiNetResponseData(data)
- var indexInfoList []models.FenWeiNetIndexInfo
- productName := "动力煤供应量"
- for _, data := range responseData {
- var frequency string
- if data.MonthlyValueChnName != "" && strings.Contains(data.MonthlyValueChnName, "月度") {
- frequency = "月度"
- } else if data.WeekValueChnName != "" && strings.Contains(data.WeekValueChnName, "周度") {
- frequency = "周度"
- } else {
- frequency = "日度"
- }
- indexInfoList = append(indexInfoList, models.FenWeiNetIndexInfo{
- IndexName: productName + data.ProvinceName + "/汾渭",
- Unit: data.MonthlyValueChnUnit,
- Frequency: frequency,
- TerminalCode: utils.TerminalCode,
- ClassifyName: productName,
- DataTime: data.DataDate,
- Value: data.MonthlyValue,
- })
- }
- return indexInfoList, nil
- }
- // CokingCleanCoalSupplyProcessor 炼焦精煤供应量
- type CokingCleanCoalSupplyProcessor struct {
- BaseProcessor
- }
- func (p *CokingCleanCoalSupplyProcessor) GenerateRequestParams(currentTime string) map[string]string {
- params := models.RequestParams{
- Category: nil,
- CheckedDims: map[string][]string{
- "province": {"20", "16", "21", "6", "19", "23", "8", "1", "7", "17", "9", "15", "11", "22", "24", "4", "25", "12", "14", "13", "18", "3", "10", "5", "2", "37"},
- "coal_type": {"13", "10", "9", "8", "7", "5", "3"},
- },
- DateRange: "20190820-" + currentTime,
- ProductCode: "FW4001D",
- QuotaName: "monthly_value,monthly_accumulation",
- SplitTypeKey: "coal_type",
- IsTotal: 0,
- DataType: nil,
- IsSeason: 1,
- }
- // 将结构体转换为 JSON 字符串
- paramsJSON, _ := json.Marshal(params)
- // 返回为 map[string]string 类型
- return map[string]string{
- "params": string(paramsJSON),
- }
- }
- func (p *CokingCleanCoalSupplyProcessor) ProcessResponse(data string) ([]models.FenWeiNetIndexInfo, error) {
- responseData := fillFenWeiNetResponseData(data)
- var indexInfoList []models.FenWeiNetIndexInfo
- productName := "炼焦精煤供应量"
- for _, data := range responseData {
- var frequency string
- if data.MonthlyValueChnName != "" && strings.Contains(data.MonthlyValueChnName, "月度") {
- frequency = "月度"
- } else if data.WeekValueChnName != "" && strings.Contains(data.WeekValueChnName, "周度") {
- frequency = "周度"
- } else {
- frequency = data.MonthlyValueChnName
- }
- indexInfoList = append(indexInfoList, models.FenWeiNetIndexInfo{
- IndexName: productName + data.CoalTypeName + "/汾渭",
- Unit: data.MonthlyValueChnUnit,
- Frequency: frequency,
- TerminalCode: utils.TerminalCode,
- ClassifyName: productName,
- DataTime: data.DataDate,
- Value: data.MonthlyValue,
- })
- }
- return indexInfoList, nil
- }
- // RawCoalProvinceProductionProcessor 原煤分省分煤种产量
- type RawCoalProvinceProductionProcessor struct {
- BaseProcessor
- }
- func (p *RawCoalProvinceProductionProcessor) GenerateRequestParams(currentTime string) map[string]string {
- params := models.RequestParams{
- Category: nil,
- CheckedDims: map[string][]string{
- "province": {"20", "16", "21", "6", "19", "23", "8", "1", "7", "17", "9", "15", "11", "22", "24", "4", "25", "12", "14", "13", "18", "3", "10", "5", "2", "37"},
- "coal_type": {"14", "6", "40", "21"},
- },
- DateRange: "20190820-" + currentTime,
- ProductCode: "FW3050D",
- QuotaName: "monthly_value,monthly_accumulation",
- SplitTypeKey: "coal_type",
- IsTotal: 0,
- DataType: nil,
- IsSeason: 1,
- }
- // 将结构体转换为 JSON 字符串
- paramsJSON, _ := json.Marshal(params)
- // 返回为 map[string]string 类型
- return map[string]string{
- "params": string(paramsJSON),
- }
- }
- func (p *RawCoalProvinceProductionProcessor) ProcessResponse(data string) ([]models.FenWeiNetIndexInfo, error) {
- responseData := fillFenWeiNetResponseData(data)
- var indexInfoList []models.FenWeiNetIndexInfo
- productName := "原煤分省分煤种产量"
- for _, data := range responseData {
- var frequency string
- if data.MonthlyValueChnName != "" && strings.Contains(data.MonthlyValueChnName, "月度") {
- frequency = "月度"
- } else if data.WeekValueChnName != "" && strings.Contains(data.WeekValueChnName, "周度") {
- frequency = "周度"
- } else {
- frequency = data.MonthlyValueChnName
- }
- indexInfoList = append(indexInfoList, models.FenWeiNetIndexInfo{
- IndexName: productName + data.CoalTypeName + "/汾渭",
- Unit: data.MonthlyValueChnUnit,
- Frequency: frequency,
- TerminalCode: utils.TerminalCode,
- ClassifyName: productName,
- DataTime: data.DataDate,
- Value: data.MonthlyValue,
- })
- }
- return indexInfoList, nil
- }
- // StateOwnedKeyCoalMineRawCoalProductionProcessor 国有重点煤矿原煤产量
- type StateOwnedKeyCoalMineRawCoalProductionProcessor struct {
- BaseProcessor
- }
- func (p *StateOwnedKeyCoalMineRawCoalProductionProcessor) GenerateRequestParams(currentTime string) map[string]string {
- params := models.RequestParams{
- Category: nil,
- CheckedDims: map[string][]string{
- "province": {"20", "16", "21", "6", "19", "23", "8", "1", "7", "17", "9", "15", "11", "22", "24", "4", "25", "12", "14", "13", "2", "27", "28"},
- },
- DateRange: "20190820-" + currentTime,
- ProductCode: "FW3007D",
- QuotaName: "monthly_value,monthly_accumulation",
- SplitTypeKey: "province",
- IsTotal: 0,
- DataType: nil,
- IsSeason: 1,
- }
- // 将结构体转换为 JSON 字符串
- paramsJSON, _ := json.Marshal(params)
- // 返回为 map[string]string 类型
- return map[string]string{
- "params": string(paramsJSON),
- }
- }
- func (p *StateOwnedKeyCoalMineRawCoalProductionProcessor) ProcessResponse(data string) ([]models.FenWeiNetIndexInfo, error) {
- responseData := fillFenWeiNetResponseData(data)
- var indexInfoList []models.FenWeiNetIndexInfo
- productName := "国有重点煤矿原煤产量"
- for _, data := range responseData {
- var frequency string
- if data.MonthlyValueChnName != "" && strings.Contains(data.MonthlyValueChnName, "月度") {
- frequency = "月度"
- } else if data.WeekValueChnName != "" && strings.Contains(data.WeekValueChnName, "周度") {
- frequency = "周度"
- } else {
- frequency = data.MonthlyValueChnName
- }
- indexInfoList = append(indexInfoList, models.FenWeiNetIndexInfo{
- IndexName: productName + data.ProvinceName + "/汾渭",
- Unit: data.MonthlyValueChnUnit,
- Frequency: frequency,
- TerminalCode: utils.TerminalCode,
- ClassifyName: productName,
- DataTime: data.DataDate,
- Value: data.MonthlyValue,
- })
- }
- return indexInfoList, nil
- }
- // CokingBituminousCoalProductionProcessor 炼焦烟煤分煤种产量
- type CokingBituminousCoalProductionProcessor struct {
- BaseProcessor
- }
- func (p *CokingBituminousCoalProductionProcessor) GenerateRequestParams(currentTime string) map[string]string {
- params := models.RequestParams{
- Category: nil,
- CheckedDims: map[string][]string{
- "province": {"20", "16", "21", "6", "19", "23", "8", "1", "7", "17", "9", "15", "11", "22", "24", "4", "25", "12", "14", "13", "18", "3", "10", "5", "2", "37"},
- "coal_type": {"13", "10", "9", "8", "7", "5", "3"},
- },
- DateRange: "20190820-" + currentTime,
- ProductCode: "FW3001D",
- QuotaName: "monthly_value,monthly_accumulation",
- SplitTypeKey: "coal_type",
- IsTotal: 0,
- DataType: nil,
- IsSeason: 1,
- }
- // 将结构体转换为 JSON 字符串
- paramsJSON, _ := json.Marshal(params)
- // 返回为 map[string]string 类型
- return map[string]string{
- "params": string(paramsJSON),
- }
- }
- func (p *CokingBituminousCoalProductionProcessor) ProcessResponse(data string) ([]models.FenWeiNetIndexInfo, error) {
- responseData := fillFenWeiNetResponseData(data)
- var indexInfoList []models.FenWeiNetIndexInfo
- productName := "炼焦烟煤分煤种产量"
- for _, data := range responseData {
- var frequency string
- if data.MonthlyValueChnName != "" && strings.Contains(data.MonthlyValueChnName, "月度") {
- frequency = "月度"
- } else if data.WeekValueChnName != "" && strings.Contains(data.WeekValueChnName, "周度") {
- frequency = "周度"
- } else {
- frequency = data.MonthlyValueChnName
- }
- indexInfoList = append(indexInfoList, models.FenWeiNetIndexInfo{
- IndexName: productName + data.CoalTypeName + "/汾渭",
- Unit: data.MonthlyValueChnUnit,
- Frequency: frequency,
- TerminalCode: utils.TerminalCode,
- ClassifyName: productName,
- DataTime: data.DataDate,
- Value: data.MonthlyValue,
- })
- }
- return indexInfoList, nil
- }
- // ThermalCoalInventorySocietyProcessor 动力煤库存-全社会
- type ThermalCoalInventorySocietyProcessor struct {
- BaseProcessor
- }
- func (p *ThermalCoalInventorySocietyProcessor) GenerateRequestParams(currentTime string) map[string]string {
- params := models.RequestParams{
- Category: "79",
- CheckedDims: map[string][]string{
- "product_item_code": {"FW8004D-1"},
- },
- DateRange: "20190820-" + currentTime,
- ProductCode: "FW8004D",
- QuotaName: "stock,avaliable_days,daily_consumption,monthly_value,inventory_index,week_value",
- SplitTypeKey: "",
- DataType: nil,
- IsSeason: 1,
- }
- // 将结构体转换为 JSON 字符串
- paramsJSON, _ := json.Marshal(params)
- // 返回为 map[string]string 类型
- return map[string]string{
- "params": string(paramsJSON),
- }
- }
- func (p *ThermalCoalInventorySocietyProcessor) ProcessResponse(data string) ([]models.FenWeiNetIndexInfo, error) {
- responseDataMap := fillFenWeiNetResponseMapData(data)
- var indexInfoList []models.FenWeiNetIndexInfo
- productName := "动力煤库存-全社会"
- for productCategoryName, responseDataList := range responseDataMap {
- if productCategoryName != productName {
- continue
- }
- for _, data := range responseDataList {
- var frequency string
- if data.MonthlyValueChnName != "" && strings.Contains(data.MonthlyValueChnName, "月度") {
- frequency = "月度"
- } else if data.WeekValueChnName != "" && strings.Contains(data.WeekValueChnName, "周度") {
- frequency = "周度"
- } else {
- frequency = data.MonthlyValueChnName
- }
- indexInfoList = append(indexInfoList, models.FenWeiNetIndexInfo{
- IndexName: productName + "/汾渭",
- Unit: data.MonthlyValueChnUnit,
- Frequency: frequency,
- TerminalCode: utils.TerminalCode,
- ClassifyName: productName,
- DataTime: data.DataDate,
- Value: data.MonthlyValue,
- })
- }
- }
- return indexInfoList, nil
- }
- // ThermalCoalInventoryProductionProcessor 动力煤库存-生产企业
- type ThermalCoalInventoryProductionProcessor struct {
- BaseProcessor
- }
- func (p *ThermalCoalInventoryProductionProcessor) GenerateRequestParams(currentTime string) map[string]string {
- params := models.RequestParams{
- Category: "116",
- CheckedDims: map[string][]string{
- "product_item_code": {"FW8004D-2"},
- },
- DateRange: "20190820-" + currentTime,
- ProductCode: "FW8004D",
- QuotaName: "stock,avaliable_days,daily_consumption,monthly_value,inventory_index,week_value",
- SplitTypeKey: "",
- DataType: nil,
- IsSeason: 1,
- }
- // 将结构体转换为 JSON 字符串
- paramsJSON, _ := json.Marshal(params)
- // 返回为 map[string]string 类型
- return map[string]string{
- "params": string(paramsJSON),
- }
- }
- func (p *ThermalCoalInventoryProductionProcessor) ProcessResponse(data string) ([]models.FenWeiNetIndexInfo, error) {
- responseDataMap := fillFenWeiNetResponseMapData(data)
- var indexInfoList []models.FenWeiNetIndexInfo
- productName := "动力煤库存-生产企业"
- for productCategoryName, responseDataList := range responseDataMap {
- if productCategoryName != productName {
- continue
- }
- for _, data := range responseDataList {
- var frequency string
- if data.MonthlyValueChnName != "" && strings.Contains(data.MonthlyValueChnName, "月度") {
- frequency = "月度"
- } else if data.WeekValueChnName != "" && strings.Contains(data.WeekValueChnName, "周度") {
- frequency = "周度"
- } else {
- frequency = data.MonthlyValueChnName
- }
- indexInfoList = append(indexInfoList, models.FenWeiNetIndexInfo{
- IndexName: productName + "/汾渭",
- Unit: data.WeekValueChnUnit,
- Frequency: frequency,
- TerminalCode: utils.TerminalCode,
- ClassifyName: productName,
- DataTime: data.DataDate,
- Value: data.MonthlyValue,
- })
- }
- }
- return indexInfoList, nil
- }
- // ThermalCoalInventorySixPowerPlantProcessor 动力煤库存-六大电厂
- type ThermalCoalInventorySixPowerPlantProcessor struct {
- BaseProcessor
- }
- func (p *ThermalCoalInventorySixPowerPlantProcessor) GenerateRequestParams(currentTime string) map[string]string {
- params := models.RequestParams{
- Category: "118",
- CheckedDims: map[string][]string{
- "product_item_code": {"FW8004D-125500", "FW8004D-112534", "FW8004D-112548", "FW8004D-112549", "FW8004D-1129", "FW8004D-125", "FW8004D-125382", "FW8004D-125383"},
- },
- DateRange: "20190820-" + currentTime,
- ProductCode: "FW8004D",
- QuotaName: "stock,avaliable_days,daily_consumption,monthly_value,inventory_index,week_value",
- SplitTypeKey: "",
- DataType: nil,
- IsSeason: 1,
- }
- // 将结构体转换为 JSON 字符串
- paramsJSON, _ := json.Marshal(params)
- // 返回为 map[string]string 类型
- return map[string]string{
- "params": string(paramsJSON),
- }
- }
- func (p *ThermalCoalInventorySixPowerPlantProcessor) ProcessResponse(data string) ([]models.FenWeiNetIndexInfo, error) {
- responseDataMap := fillFenWeiNetResponseMapData(data)
- var indexInfoList []models.FenWeiNetIndexInfo
- productName := "动力煤库存"
- for productCategoryName, responseDataList := range responseDataMap {
- for _, data := range responseDataList {
- var frequency string
- if data.MonthlyValueChnName != "" && strings.Contains(data.MonthlyValueChnName, "月度") {
- frequency = "月度"
- } else if data.WeekValueChnName != "" && strings.Contains(data.WeekValueChnName, "周度") {
- frequency = "周度"
- } else {
- frequency = "日度"
- }
- classifyName := "动力煤库存-六大电厂"
- // 库存
- indexInfoList = append(indexInfoList, models.FenWeiNetIndexInfo{
- IndexName: productName + productCategoryName + data.StockChnName + "/汾渭",
- Unit: data.StockChnUnit,
- Frequency: frequency,
- TerminalCode: utils.TerminalCode,
- ClassifyName: classifyName,
- DataTime: data.DataDate,
- Value: data.Stock,
- })
- // 可用天数
- indexInfoList = append(indexInfoList, models.FenWeiNetIndexInfo{
- IndexName: productName + productCategoryName + data.AvaliableDaysChnName + "/汾渭",
- Unit: data.AvaliableDaysChnUnit,
- Frequency: frequency,
- TerminalCode: utils.TerminalCode,
- ClassifyName: classifyName,
- DataTime: data.DataDate,
- Value: data.AvaliableDays,
- })
- // 日耗
- indexInfoList = append(indexInfoList, models.FenWeiNetIndexInfo{
- IndexName: productName + productCategoryName + data.DailyConsumptionChnName + "/汾渭",
- Unit: data.DailyConsumptionChnUnit,
- Frequency: frequency,
- TerminalCode: utils.TerminalCode,
- ClassifyName: classifyName,
- DataTime: data.DataDate,
- Value: data.DailyConsumption,
- })
- }
- }
- return indexInfoList, nil
- }
- // CokingCoalInventorySocietyProcessor 炼焦煤库存-全社会
- type CokingCoalInventorySocietyProcessor struct {
- BaseProcessor
- }
- func (p *CokingCoalInventorySocietyProcessor) GenerateRequestParams(currentTime string) map[string]string {
- params := models.RequestParams{
- Category: "79",
- CheckedDims: map[string][]string{
- "product_item_code": {"FW8005D-1"},
- },
- DateRange: "20190820-" + currentTime,
- ProductCode: "FW8005D",
- QuotaName: "stock,monthly_value,inventory_index,week_value",
- SplitTypeKey: "",
- DataType: nil,
- IsSeason: 1,
- }
- // 将结构体转换为 JSON 字符串
- paramsJSON, _ := json.Marshal(params)
- // 返回为 map[string]string 类型
- return map[string]string{
- "params": string(paramsJSON),
- }
- }
- func (p *CokingCoalInventorySocietyProcessor) ProcessResponse(data string) ([]models.FenWeiNetIndexInfo, error) {
- responseDataMap := fillFenWeiNetResponseMapData(data)
- var indexInfoList []models.FenWeiNetIndexInfo
- productName := "炼焦煤库存-全社会"
- for productCategoryName, responseDataList := range responseDataMap {
- if productCategoryName == "合计" {
- continue
- }
- for _, data := range responseDataList {
- var frequency string
- if data.MonthlyValueChnName != "" && strings.Contains(data.MonthlyValueChnName, "月度") {
- frequency = "月度"
- } else if data.WeekValueChnName != "" && strings.Contains(data.WeekValueChnName, "周度") {
- frequency = "周度"
- } else {
- frequency = data.MonthlyValueChnName
- }
- indexInfoList = append(indexInfoList, models.FenWeiNetIndexInfo{
- IndexName: productCategoryName + "/汾渭",
- Unit: data.MonthlyValueChnUnit,
- Frequency: frequency,
- TerminalCode: utils.TerminalCode,
- ClassifyName: productName,
- DataTime: data.DataDate,
- Value: data.MonthlyValue,
- })
- }
- }
- return indexInfoList, nil
- }
- // CokingCoalInventoryProductionProcessor 炼焦煤库存-生产企业
- type CokingCoalInventoryProductionProcessor struct {
- BaseProcessor
- }
- func (p *CokingCoalInventoryProductionProcessor) GenerateRequestParams(currentTime string) map[string]string {
- params := models.RequestParams{
- Category: "116",
- CheckedDims: map[string][]string{
- "product_item_code": {"FW8005D-2"},
- },
- DateRange: "20190820-" + currentTime,
- ProductCode: "FW8005D",
- QuotaName: "stock,monthly_value,inventory_index,week_value",
- SplitTypeKey: "",
- DataType: nil,
- IsSeason: 1,
- }
- // 将结构体转换为 JSON 字符串
- paramsJSON, _ := json.Marshal(params)
- // 返回为 map[string]string 类型
- return map[string]string{
- "params": string(paramsJSON),
- }
- }
- func (p *CokingCoalInventoryProductionProcessor) ProcessResponse(data string) ([]models.FenWeiNetIndexInfo, error) {
- responseDataMap := fillFenWeiNetResponseMapData(data)
- var indexInfoList []models.FenWeiNetIndexInfo
- productName := "炼焦煤库存-生产企业"
- for productCategoryName, responseDataList := range responseDataMap {
- if productCategoryName == "合计" {
- continue
- }
- for _, data := range responseDataList {
- var frequency string
- if data.MonthlyValueChnName != "" && strings.Contains(data.MonthlyValueChnName, "月度") {
- frequency = "月度"
- } else if data.WeekValueChnName != "" && strings.Contains(data.WeekValueChnName, "周度") {
- frequency = "周度"
- } else {
- frequency = data.MonthlyValueChnName
- }
- indexInfoList = append(indexInfoList, models.FenWeiNetIndexInfo{
- IndexName: productCategoryName + "/汾渭",
- Unit: data.WeekValueChnUnit,
- Frequency: frequency,
- TerminalCode: utils.TerminalCode,
- ClassifyName: productName,
- DataTime: data.DataDate,
- Value: data.WeekValue,
- })
- }
- }
- return indexInfoList, nil
- }
- // CokingCoalInventoryDownstreamProcessor 炼焦煤库存-下游企业
- type CokingCoalInventoryDownstreamProcessor struct {
- BaseProcessor
- }
- func (p *CokingCoalInventoryDownstreamProcessor) GenerateRequestParams(currentTime string) map[string]string {
- params := models.RequestParams{
- Category: "117",
- CheckedDims: map[string][]string{
- "product_item_code": {"FW8005D-3", "FW8005D-5"},
- },
- DateRange: "20190820-" + currentTime,
- ProductCode: "FW8005D",
- QuotaName: "stock,monthly_value,inventory_index,week_value",
- SplitTypeKey: "",
- DataType: nil,
- IsSeason: 1,
- }
- // 将结构体转换为 JSON 字符串
- paramsJSON, _ := json.Marshal(params)
- // 返回为 map[string]string 类型
- return map[string]string{
- "params": string(paramsJSON),
- }
- }
- func (p *CokingCoalInventoryDownstreamProcessor) ProcessResponse(data string) ([]models.FenWeiNetIndexInfo, error) {
- responseDataMap := fillFenWeiNetResponseMapData(data)
- var indexInfoList []models.FenWeiNetIndexInfo
- productName := "炼焦煤库存-下游企业"
- for productCategoryName, responseDataList := range responseDataMap {
- if productCategoryName == "合计" {
- continue
- }
- for _, data := range responseDataList {
- frequency := "周度"
- indexInfoList = append(indexInfoList, models.FenWeiNetIndexInfo{
- IndexName: productCategoryName + "/汾渭",
- Unit: data.StockChnUnit,
- Frequency: frequency,
- TerminalCode: utils.TerminalCode,
- ClassifyName: productName,
- DataTime: data.DataDate,
- Value: data.Stock,
- })
- }
- }
- return indexInfoList, nil
- }
- // NationalCoalMineInventoryProcessor 全国煤矿库存
- type NationalCoalMineInventoryProcessor struct {
- BaseProcessor
- }
- func (p *NationalCoalMineInventoryProcessor) GenerateRequestParams(currentTime string) map[string]string {
- params := models.RequestParams{
- Category: nil,
- CheckedDims: map[string][]string{},
- DateRange: "20190820-" + currentTime,
- ProductCode: "FW8001D",
- QuotaName: "monthly_value",
- SplitTypeKey: "",
- DataType: nil,
- IsSeason: 1,
- }
- // 将结构体转换为 JSON 字符串
- paramsJSON, _ := json.Marshal(params)
- // 返回为 map[string]string 类型
- return map[string]string{
- "params": string(paramsJSON),
- }
- }
- func (p *NationalCoalMineInventoryProcessor) ProcessResponse(data string) ([]models.FenWeiNetIndexInfo, error) {
- responseData := fillFenWeiNetResponseData(data)
- var indexInfoList []models.FenWeiNetIndexInfo
- productName := "全国煤矿库存"
- for _, data := range responseData {
- var frequency string
- if data.MonthlyValueChnName != "" && strings.Contains(data.MonthlyValueChnName, "月度") {
- frequency = "月度"
- } else if data.WeekValueChnName != "" && strings.Contains(data.WeekValueChnName, "周度") {
- frequency = "周度"
- } else {
- frequency = "日度"
- }
- indexInfoList = append(indexInfoList, models.FenWeiNetIndexInfo{
- IndexName: productName + "/汾渭",
- Unit: data.MonthlyValueChnUnit,
- Frequency: frequency,
- TerminalCode: utils.TerminalCode,
- ClassifyName: productName,
- DataTime: data.DataDate,
- Value: data.MonthlyValue,
- })
- }
- return indexInfoList, nil
- }
- // StateOwnedKeyCoalMineInventoryProcessor 国有重点煤矿库存
- type StateOwnedKeyCoalMineInventoryProcessor struct {
- BaseProcessor
- }
- func (p *StateOwnedKeyCoalMineInventoryProcessor) GenerateRequestParams(currentTime string) map[string]string {
- params := models.RequestParams{
- Category: nil,
- CheckedDims: map[string][]string{
- "province": {"20", "16", "21", "6", "19", "23", "8", "1", "7", "17", "9", "15", "11", "22", "24", "4", "25", "12", "14", "13", "2", "27", "28"},
- },
- DateRange: "20190820-" + currentTime,
- ProductCode: "FW8003D",
- QuotaName: "monthly_value",
- SplitTypeKey: "province",
- IsTotal: "",
- DataType: nil,
- IsSeason: 1,
- }
- // 将结构体转换为 JSON 字符串
- paramsJSON, _ := json.Marshal(params)
- // 返回为 map[string]string 类型
- return map[string]string{
- "params": string(paramsJSON),
- }
- }
- func (p *StateOwnedKeyCoalMineInventoryProcessor) ProcessResponse(data string) ([]models.FenWeiNetIndexInfo, error) {
- responseData := fillFenWeiNetResponseData(data)
- var indexInfoList []models.FenWeiNetIndexInfo
- productName := "国有重点煤矿库存"
- for _, data := range responseData {
- var frequency string
- if data.MonthlyValueChnName != "" && strings.Contains(data.MonthlyValueChnName, "月度") {
- frequency = "月度"
- } else if data.WeekValueChnName != "" && strings.Contains(data.WeekValueChnName, "周度") {
- frequency = "周度"
- } else {
- frequency = "日度"
- }
- indexInfoList = append(indexInfoList, models.FenWeiNetIndexInfo{
- IndexName: productName + data.ProvinceName + "/汾渭",
- Unit: data.MonthlyValueChnUnit,
- Frequency: frequency,
- TerminalCode: utils.TerminalCode,
- ClassifyName: productName,
- DataTime: data.DataDate,
- Value: data.MonthlyValue,
- })
- }
- return indexInfoList, nil
- }
- // CokeInventoryProcessor 焦炭库存
- type CokeInventoryProcessor struct {
- BaseProcessor
- }
- func (p *CokeInventoryProcessor) GenerateRequestParams(currentTime string) map[string]string {
- params := models.RequestParams{
- Category: nil,
- CheckedDims: map[string][]string{
- "product_item_code": {"FW1405D-1", "FW1405D-2", "FW1405D-3", "FW1405D-4", "FW1405D-5", "FW1405D-6", "FW1405D-7"},
- },
- DateRange: "20190820-" + currentTime,
- ProductCode: "FW1405D",
- QuotaName: "stock,inventory_index",
- SplitTypeKey: "",
- DataType: nil,
- IsSeason: 1,
- }
- // 将结构体转换为 JSON 字符串
- paramsJSON, _ := json.Marshal(params)
- // 返回为 map[string]string 类型
- return map[string]string{
- "params": string(paramsJSON),
- }
- }
- func (p *CokeInventoryProcessor) ProcessResponse(data string) ([]models.FenWeiNetIndexInfo, error) {
- responseDataMap := fillFenWeiNetResponseMapData(data)
- var indexInfoList []models.FenWeiNetIndexInfo
- productName := "焦炭库存"
- for productCategoryName, responseDataList := range responseDataMap {
- utils.FileLog.Info(fmt.Sprintf("productName: %s, responseDataList:size: %v", productName, len(responseDataList)))
- for _, data := range responseDataList {
- var frequency string
- productCodeMap := map[string]struct{}{
- "FW1405D-1": {},
- "FW1405D-2": {},
- "FW1405D-3": {},
- "FW1405D-6": {},
- "FW1405D-7": {},
- }
- if _, ok := productCodeMap[data.ProductItemCode]; ok {
- frequency = "周度"
- } else {
- frequency = "日度"
- }
- var unit string
- if data.InventoryIndexChnUnit != "" {
- unit = data.InventoryIndexChnUnit
- } else {
- unit = data.StockChnUnit
- }
- var value float64
- if data.InventoryIndex != 0 {
- value = data.InventoryIndex
- } else {
- value = data.Stock
- }
- indexInfoList = append(indexInfoList, models.FenWeiNetIndexInfo{
- IndexName: productName + productCategoryName + "/汾渭",
- Unit: unit,
- Frequency: frequency,
- TerminalCode: utils.TerminalCode,
- ClassifyName: productName,
- DataTime: data.DataDate,
- Value: value,
- })
- }
- }
- return indexInfoList, nil
- }
- // PortDataInventoryNorthernPortProcessor 港口数据-库存-北方港口
- type PortDataInventoryNorthernPortProcessor struct {
- BaseProcessor
- }
- func (p *PortDataInventoryNorthernPortProcessor) GenerateRequestParams(currentTime string) map[string]string {
- params := models.RequestParams{
- Category: "79",
- CheckedDims: map[string][]string{
- "code": {"2332", "2333", "2335", "2334", "2337", "2339", "2340", "2341", "2342"},
- },
- DateRange: "20190820-" + currentTime,
- ProductCode: "FW1203D",
- QuotaName: "stock",
- SplitTypeKey: "product_item_code",
- IsTotal: 0,
- DataType: nil,
- Type: 2,
- IsSeason: 1,
- }
- // 将结构体转换为 JSON 字符串
- paramsJSON, _ := json.Marshal(params)
- // 返回为 map[string]string 类型
- return map[string]string{
- "params": string(paramsJSON),
- }
- }
- func (p *PortDataInventoryNorthernPortProcessor) ProcessResponse(data string) ([]models.FenWeiNetIndexInfo, error) {
- responseData := fillFenWeiNetResponseData(data)
- var indexInfoList []models.FenWeiNetIndexInfo
- productName := "港口数据-库存-北方港口"
- for _, data := range responseData {
- var frequency string
- if data.MonthlyValueChnName != "" && strings.Contains(data.MonthlyValueChnName, "月度") {
- frequency = "月度"
- } else if data.WeekValueChnName != "" && strings.Contains(data.WeekValueChnName, "周度") {
- frequency = "周度"
- } else {
- frequency = "日度"
- }
- indexInfoList = append(indexInfoList, models.FenWeiNetIndexInfo{
- IndexName: productName + data.ProductItemName + "/汾渭",
- Unit: data.StockChnUnit,
- Frequency: frequency,
- TerminalCode: utils.TerminalCode,
- ClassifyName: productName,
- DataTime: data.DataDate,
- Value: data.Stock,
- })
- }
- return indexInfoList, nil
- }
- // PortDataInventoryInlandPortProcessor 港口数据-库存-江内港口
- type PortDataInventoryInlandPortProcessor struct {
- BaseProcessor
- }
- func (p *PortDataInventoryInlandPortProcessor) GenerateRequestParams(currentTime string) map[string]string {
- params := models.RequestParams{
- Category: "79",
- CheckedDims: map[string][]string{
- "code": {"2321", "2320", "2324", "2323", "2322", "2325"},
- },
- DateRange: "20190820-" + currentTime,
- ProductCode: "FW1203D",
- QuotaName: "stock",
- SplitTypeKey: "product_item_code",
- IsTotal: 0,
- DataType: nil,
- Type: 2,
- IsSeason: 1,
- }
- // 将结构体转换为 JSON 字符串
- paramsJSON, _ := json.Marshal(params)
- // 返回为 map[string]string 类型
- return map[string]string{
- "params": string(paramsJSON),
- }
- }
- func (p *PortDataInventoryInlandPortProcessor) ProcessResponse(data string) ([]models.FenWeiNetIndexInfo, error) {
- responseData := fillFenWeiNetResponseData(data)
- var indexInfoList []models.FenWeiNetIndexInfo
- productName := "港口数据-库存-江内港口"
- for _, data := range responseData {
- var frequency = "周度"
- indexInfoList = append(indexInfoList, models.FenWeiNetIndexInfo{
- IndexName: productName + data.ProductItemName + "/汾渭",
- Unit: data.StockChnUnit,
- Frequency: frequency,
- TerminalCode: utils.TerminalCode,
- ClassifyName: productName,
- DataTime: data.DataDate,
- Value: data.Stock,
- })
- }
- return indexInfoList, nil
- }
- // PortDataDispatchNorthernPortProcessor 港口数据-调度-北方港口
- type PortDataDispatchNorthernPortProcessor struct {
- BaseProcessor
- }
- func (p *PortDataDispatchNorthernPortProcessor) GenerateRequestParams(currentTime string) map[string]string {
- params := models.RequestParams{
- Category: "120",
- CheckedDims: map[string][]string{
- "code": {"2364", "2365", "2366", "2363", "2367", "2368"},
- "port": {"2", "4", "7", "9", "11", "326", "327", "329", "330"},
- },
- DateRange: "20190820-" + currentTime,
- ProductCode: "FW1203D",
- QuotaName: "vehicle,ship,tons",
- SplitTypeKey: "product_item_code,port",
- IsTotal: 1,
- DataType: nil,
- Type: 2,
- IsSeason: 1,
- }
- // 将结构体转换为 JSON 字符串
- paramsJSON, _ := json.Marshal(params)
- // 返回为 map[string]string 类型
- return map[string]string{
- "params": string(paramsJSON),
- }
- }
- func (p *PortDataDispatchNorthernPortProcessor) ProcessResponse(data string) ([]models.FenWeiNetIndexInfo, error) {
- responseData := fillFenWeiNetResponseData(data)
- var indexInfoList []models.FenWeiNetIndexInfo
- productName := "港口数据-调度-北方港口"
- for _, data := range responseData {
- var frequency = "日度"
- var unit string
- if data.VehicleChnUnit != "" {
- unit = data.VehicleChnUnit
- } else if data.TonsChnUnit != "" {
- unit = data.TonsChnUnit
- } else {
- unit = data.ShipChnUnit
- }
- indexInfoList = append(indexInfoList, models.FenWeiNetIndexInfo{
- IndexName: productName + "-" + data.PortName + data.ProductItemName + "/汾渭",
- Unit: unit,
- Frequency: frequency,
- TerminalCode: utils.TerminalCode,
- ClassifyName: productName,
- DataTime: data.DataDate,
- Value: data.Tons,
- })
- }
- return indexInfoList, nil
- }
- // PortDataThroughputProcessor 港口数据-运量
- type PortDataThroughputProcessor struct {
- BaseProcessor
- }
- func (p *PortDataThroughputProcessor) GenerateRequestParams(currentTime string) map[string]string {
- params := models.RequestParams{
- Category: "30",
- CheckedDims: map[string][]string{
- "code": {"2362"},
- "port_son": {"44", "43", "42", "41", "40", "39"},
- },
- DateRange: "20190820-" + currentTime,
- ProductCode: "FW1203D",
- QuotaName: "transport_volume",
- SplitTypeKey: "port_son",
- IsTotal: 0,
- DataType: nil,
- Type: 2,
- IsSeason: 1,
- }
- // 将结构体转换为 JSON 字符串
- paramsJSON, _ := json.Marshal(params)
- // 返回为 map[string]string 类型
- return map[string]string{
- "params": string(paramsJSON),
- }
- }
- func (p *PortDataThroughputProcessor) ProcessResponse(data string) ([]models.FenWeiNetIndexInfo, error) {
- responseData := fillFenWeiNetResponseData(data)
- var indexInfoList []models.FenWeiNetIndexInfo
- productName := "港口数据-运量"
- for _, data := range responseData {
- var frequency = "日度"
- indexInfoList = append(indexInfoList, models.FenWeiNetIndexInfo{
- IndexName: productName + data.PortSonName + "/汾渭",
- Unit: data.TransportVolumeChnUnit,
- Frequency: frequency,
- TerminalCode: utils.TerminalCode,
- ClassifyName: productName,
- DataTime: data.DataDate,
- Value: data.TransportVolume,
- })
- }
- return indexInfoList, nil
- }
- // DaqinLineDailyThroughputProcessor 大秦线日运量
- type DaqinLineDailyThroughputProcessor struct {
- BaseProcessor
- }
- func (p *DaqinLineDailyThroughputProcessor) GenerateRequestParams(currentTime string) map[string]string {
- params := models.RequestParams{
- Category: nil,
- CheckedDims: map[string][]string{},
- DateRange: "20190820-" + currentTime,
- ProductCode: "FW1107D",
- QuotaName: "stock",
- SplitTypeKey: "",
- DataType: nil,
- IsSeason: 1,
- }
- // 将结构体转换为 JSON 字符串
- paramsJSON, _ := json.Marshal(params)
- // 返回为 map[string]string 类型
- return map[string]string{
- "params": string(paramsJSON),
- }
- }
- func (p *DaqinLineDailyThroughputProcessor) ProcessResponse(data string) ([]models.FenWeiNetIndexInfo, error) {
- responseData := fillFenWeiNetResponseData(data)
- var indexInfoList []models.FenWeiNetIndexInfo
- productName := "大秦线日运量"
- for _, data := range responseData {
- var frequency = "日度"
- indexInfoList = append(indexInfoList, models.FenWeiNetIndexInfo{
- IndexName: productName + data.StockChnName + "/汾渭",
- Unit: data.StockChnUnit,
- Frequency: frequency,
- TerminalCode: utils.TerminalCode,
- ClassifyName: productName,
- DataTime: data.DataDate,
- Value: data.Stock,
- })
- }
- return indexInfoList, nil
- }
- // ThermalCoalPortPriceProcessor 动力煤港口价格
- type ThermalCoalPortPriceProcessor struct {
- BaseProcessor
- }
- func (p *ThermalCoalPortPriceProcessor) GenerateRequestParams(currentTime string) map[string]string {
- params := models.RequestParams{
- Category: nil,
- CheckedDims: map[string][]string{
- "product_item_code": {"FW2001P-1001", "FW2001P-1002", "FW2001P-1004", "FW2001P-1005", "FW2001P-1003", "FW2001P-1171"},
- },
- DateRange: "20190820-" + currentTime,
- ProductCode: "FW2310R",
- QuotaName: "price_rmb,price_index_mom",
- SplitTypeKey: "",
- DataType: nil,
- IsSeason: 1,
- }
- // 将结构体转换为 JSON 字符串
- paramsJSON, _ := json.Marshal(params)
- // 返回为 map[string]string 类型
- return map[string]string{
- "params": string(paramsJSON),
- }
- }
- func (p *ThermalCoalPortPriceProcessor) ProcessResponse(data string) ([]models.FenWeiNetIndexInfo, error) {
- responseDataMap := fillFenWeiNetResponseAStratumMapData(data)
- var indexInfoList []models.FenWeiNetIndexInfo
- productName := "动力煤港口价格"
- for productCategoryName, responseDataList := range responseDataMap {
- utils.FileLog.Info(fmt.Sprintf("productName: %s, responseDataList:size: %v", productName, len(responseDataList)))
- for _, data := range responseDataList {
- var frequency = "日度"
- indexInfoList = append(indexInfoList, models.FenWeiNetIndexInfo{
- IndexName: productName + productCategoryName + "-" + data.PriceRmbChnName + "/汾渭",
- Unit: data.PriceRmbChnUnit,
- Frequency: frequency,
- TerminalCode: utils.TerminalCode,
- ClassifyName: productName,
- DataTime: data.DataDate,
- Value: data.PriceRmb,
- })
- indexInfoList = append(indexInfoList, models.FenWeiNetIndexInfo{
- IndexName: productName + productCategoryName + "-" + data.PriceIndexMomChnName + "/汾渭",
- Unit: data.PriceIndexMomChnUnit,
- Frequency: frequency,
- TerminalCode: utils.TerminalCode,
- ClassifyName: productName,
- DataTime: data.DataDate,
- Value: data.PriceIndexMom,
- })
- }
- }
- return indexInfoList, nil
- }
- // ThermalCoalConsumptionProcessor 动力煤消费量
- type ThermalCoalConsumptionProcessor struct {
- BaseProcessor
- }
- func (p *ThermalCoalConsumptionProcessor) GenerateRequestParams(currentTime string) map[string]string {
- params := models.RequestParams{
- Category: nil,
- CheckedDims: map[string][]string{
- "product_item_code": {"FW5002D-1", "FW5002D-2", "FW5002D-3", "FW5002D-4", "FW5002D-5", "FW5002D-6", "FW5002D-7"},
- },
- DateRange: "20190820-" + currentTime,
- ProductCode: "FW5002D",
- QuotaName: "monthly_value,monthly_accumulation",
- SplitTypeKey: "",
- DataType: nil,
- IsSeason: 1,
- }
- // 将结构体转换为 JSON 字符串
- paramsJSON, _ := json.Marshal(params)
- // 返回为 map[string]string 类型
- return map[string]string{
- "params": string(paramsJSON),
- }
- }
- func (p *ThermalCoalConsumptionProcessor) ProcessResponse(data string) ([]models.FenWeiNetIndexInfo, error) {
- responseDataMap := fillFenWeiNetResponseMapData(data)
- var indexInfoList []models.FenWeiNetIndexInfo
- productName := "动力煤消费量"
- for productCategoryName, responseDataList := range responseDataMap {
- utils.FileLog.Info(fmt.Sprintf("productName: %s, responseDataList:size: %v", productName, len(responseDataList)))
- for _, data := range responseDataList {
- var frequency string
- if data.MonthlyValueChnName != "" && strings.Contains(data.MonthlyValueChnName, "月度") {
- frequency = "月度"
- } else if data.WeekValueChnName != "" && strings.Contains(data.WeekValueChnName, "周度") {
- frequency = "周度"
- } else {
- frequency = "日度"
- }
- indexInfoList = append(indexInfoList, models.FenWeiNetIndexInfo{
- IndexName: productName + productCategoryName + "/汾渭",
- Unit: data.MonthlyValueChnUnit,
- Frequency: frequency,
- TerminalCode: utils.TerminalCode,
- ClassifyName: productName,
- DataTime: data.DataDate,
- Value: data.MonthlyValue,
- })
- }
- }
- return indexInfoList, nil
- }
- // CokingCleanCoalConsumptionProcessor 炼焦精煤消费量
- type CokingCleanCoalConsumptionProcessor struct {
- BaseProcessor
- }
- func (p *CokingCleanCoalConsumptionProcessor) GenerateRequestParams(currentTime string) map[string]string {
- params := models.RequestParams{
- Category: nil,
- CheckedDims: map[string][]string{},
- DateRange: "20190820-" + currentTime,
- ProductCode: "FW5001D",
- QuotaName: "monthly_value,monthly_accumulation",
- SplitTypeKey: "",
- DataType: nil,
- IsSeason: 1,
- }
- // 将结构体转换为 JSON 字符串
- paramsJSON, _ := json.Marshal(params)
- // 返回为 map[string]string 类型
- return map[string]string{
- "params": string(paramsJSON),
- }
- }
- func (p *CokingCleanCoalConsumptionProcessor) ProcessResponse(data string) ([]models.FenWeiNetIndexInfo, error) {
- responseData := fillFenWeiNetResponseData(data)
- var indexInfoList []models.FenWeiNetIndexInfo
- productName := "炼焦精煤消费量"
- for _, data := range responseData {
- var frequency string
- if data.MonthlyValueChnName != "" && strings.Contains(data.MonthlyValueChnName, "月度") {
- frequency = "月度"
- } else if data.WeekValueChnName != "" && strings.Contains(data.WeekValueChnName, "周度") {
- frequency = "周度"
- } else {
- frequency = "日度"
- }
- indexInfoList = append(indexInfoList, models.FenWeiNetIndexInfo{
- IndexName: productName + "/汾渭",
- Unit: data.MonthlyValueChnUnit,
- Frequency: frequency,
- TerminalCode: utils.TerminalCode,
- ClassifyName: productName,
- DataTime: data.DataDate,
- Value: data.MonthlyValue,
- })
- }
- return indexInfoList, nil
- }
- func fillFenWeiNetResponseData(data string) []models.FenWeiNetResponse {
- var result models.FenWeiNetResponseWrapper
- err := json.Unmarshal([]byte(data), &result)
- if err != nil {
- return nil
- }
- responseData := result.Data.Data
- return responseData
- }
- func fillFenWeiNetResponseMapData(data string) map[string][]models.FenWeiNetResponse {
- var result models.FenWeiNetResponseMapWrapper
- err := json.Unmarshal([]byte(data), &result)
- if err != nil {
- return nil
- }
- responseData := result.Data.Data
- return responseData
- }
- func fillFenWeiNetResponseAStratumMapData(data string) map[string][]models.FenWeiNetResponse {
- var result models.FenWeiNetResponseAStratumMapWrapper
- err := json.Unmarshal([]byte(data), &result)
- if err != nil {
- return nil
- }
- responseData := result.Data
- return responseData
- }
|