|
@@ -19,22 +19,12 @@ func GetPCSGBloombergGeneralIndex(taskKey, frequency string) (indexes []pcsg.Bas
|
|
|
if len(apiData) == 0 {
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
- conf, e := LoadPCSGBloombergTask(taskKey)
|
|
|
- if e != nil {
|
|
|
- err = fmt.Errorf("加载配置失败, Err: %v", e)
|
|
|
- return
|
|
|
- }
|
|
|
- if conf == nil {
|
|
|
- err = fmt.Errorf("加载配置异常, %s", taskKey)
|
|
|
- return
|
|
|
- }
|
|
|
for _, v := range apiData {
|
|
|
if taskKey == "IDpcsgDailyRun11" {
|
|
|
tList := pcsg.FormatPythonBloombergDailyRun11Data2Base(v, frequency, taskKey)
|
|
|
indexes = append(indexes, tList...)
|
|
|
} else {
|
|
|
- t := pcsg.FormatPythonBloombergGeneralData2Base(v, conf)
|
|
|
+ t := pcsg.FormatPythonBloombergGeneralData2Base(v, frequency, taskKey)
|
|
|
if t.IndexCode != "" {
|
|
|
indexes = append(indexes, t)
|
|
|
}
|
|
@@ -44,7 +34,7 @@ func GetPCSGBloombergGeneralIndex(taskKey, frequency string) (indexes []pcsg.Bas
|
|
|
}
|
|
|
|
|
|
// CurlPCSGBloombergGeneralDataApi 请求通用格式数据接口
|
|
|
-func CurlPCSGBloombergGeneralDataApi(taskKey string) (resultData []map[string]interface{}, err error) {
|
|
|
+func CurlPCSGBloombergGeneralDataApi(taskKey string) (resultData []pcsg.PythonBloombergGeneralData, err error) {
|
|
|
if taskKey == "" {
|
|
|
err = fmt.Errorf("任务Key为空")
|
|
|
return
|
|
@@ -87,25 +77,3 @@ func CurlPCSGBloombergGeneralDataApi(taskKey string) (resultData []map[string]in
|
|
|
resultData = result.Data
|
|
|
return
|
|
|
}
|
|
|
-
|
|
|
-// LoadPCSGBloombergTask 加载配置
|
|
|
-func LoadPCSGBloombergTask(taskName string) (conf *pcsg.TaskConfPCSGBloomberg, err error) {
|
|
|
- filePath := "./static/pcsg_task.json"
|
|
|
- b, e := ioutil.ReadFile(filePath)
|
|
|
- if e != nil {
|
|
|
- err = fmt.Errorf("读取配置失败, err: %v", e)
|
|
|
- return
|
|
|
- }
|
|
|
- tasks := make([]*pcsg.TaskConfPCSGBloomberg, 0)
|
|
|
- if e = json.Unmarshal(b, &tasks); e != nil {
|
|
|
- err = fmt.Errorf("解析配置失败, err: %v", e)
|
|
|
- return
|
|
|
- }
|
|
|
- for _, v := range tasks {
|
|
|
- if v.TaskKey == taskName {
|
|
|
- conf = v
|
|
|
- break
|
|
|
- }
|
|
|
- }
|
|
|
- return
|
|
|
-}
|