|
@@ -11,7 +11,7 @@ import (
|
|
|
"strings"
|
|
|
)
|
|
|
|
|
|
-// 初始化基础指标数据
|
|
|
+// InitBaseIndexData 初始化基础指标数据
|
|
|
func InitBaseIndexData() {
|
|
|
var err error
|
|
|
|
|
@@ -148,8 +148,14 @@ func InitBaseIndexData() {
|
|
|
return
|
|
|
}
|
|
|
method = "edb_info/add"
|
|
|
+ sourceId, ok := IndexSourceMap[source]
|
|
|
+ if !ok {
|
|
|
+ fmt.Println("source is not defined")
|
|
|
+ fmt.Println(classifyFirst, classifySecond, classifyThree, indexCode, indexName, frequency, unit, source)
|
|
|
+ continue
|
|
|
+ }
|
|
|
indexMap := make(map[string]interface{})
|
|
|
- indexMap["Source"] = IndexSourceMap[source]
|
|
|
+ indexMap["Source"] = sourceId
|
|
|
indexMap["EdbCode"] = indexCode
|
|
|
indexMap["EdbName"] = indexName
|
|
|
indexMap["Frequency"] = frequency
|
|
@@ -180,14 +186,21 @@ func InitBaseIndexData() {
|
|
|
fmt.Println("add index success:" + indexCode)
|
|
|
|
|
|
//刷新指标
|
|
|
- if source == "wind" {
|
|
|
- method = "wind/refresh"
|
|
|
+ {
|
|
|
+ switch source {
|
|
|
+ case "wind":
|
|
|
+ method = "wind/refresh"
|
|
|
+ case "ths", "同花顺":
|
|
|
+ method = "ths/refresh"
|
|
|
+ }
|
|
|
+ if method != `` {
|
|
|
+ refreshMap := make(map[string]interface{})
|
|
|
+ refreshMap["EdbInfoId"] = indexResp.Data.EdbInfoId
|
|
|
+ refreshMap["EdbCode"] = indexCode
|
|
|
+ refreshMap["StartDate"] = "1990-01-01"
|
|
|
+ PostEdbLib(refreshMap, method)
|
|
|
+ }
|
|
|
}
|
|
|
- refreshMap := make(map[string]interface{})
|
|
|
- refreshMap["EdbInfoId"] = indexResp.Data.EdbInfoId
|
|
|
- refreshMap["EdbCode"] = indexCode
|
|
|
- refreshMap["StartDate"] = "1990-01-01"
|
|
|
- PostEdbLib(refreshMap, method)
|
|
|
} else {
|
|
|
fmt.Println("data is empty")
|
|
|
fmt.Println(classifyFirst, classifySecond, classifyThree, indexCode, indexName, frequency, unit, source)
|