Ver código fonte

fix:调整来源

Roc 11 meses atrás
pai
commit
f65027395b
2 arquivos alterados com 12 adições e 4 exclusões
  1. 10 4
      services/eta_bridge/handle_data.go
  2. 2 0
      services/eta_bridge/xy.go

+ 10 - 4
services/eta_bridge/handle_data.go

@@ -60,7 +60,7 @@ func handleInsert(edbUpdateLog *data_manage.EdbUpdateLog) (pushIndexData *PushIn
 		}
 
 		// 获取数据源中指标的基础信息
-		origInfo := getOrigInfo(edbInfo.Source, edbInfo.SubSource, edbInfo.EdbCode)
+		origInfo := getOrigInfo(edbInfo.Source, edbInfo.SubSource, edbInfo.EdbCode, edbInfo.EdbName)
 
 		// 指标信息
 		pushIndexData = &PushIndexParamDataReq{
@@ -194,7 +194,7 @@ func handleDelete(edbUpdateLog *data_manage.EdbUpdateLog) (pushIndexData *PushIn
 		}
 
 		// 获取数据源中指标的基础信息
-		origInfo := getOrigInfo(edbInfo.Source, edbInfo.SubSource, edbInfo.EdbCode)
+		origInfo := getOrigInfo(edbInfo.Source, edbInfo.SubSource, edbInfo.EdbCode, edbInfo.EdbName)
 
 		// 指标信息
 		pushIndexData = &PushIndexParamDataReq{
@@ -339,7 +339,7 @@ func handleUpdate(edbUpdateLog *data_manage.EdbUpdateLog) (pushIndexData *PushIn
 		if isUpdateEdbInfo {
 
 			// 获取数据源中指标的基础信息
-			origInfo := getOrigInfo(newEdbInfo.Source, newEdbInfo.SubSource, newEdbInfo.EdbCode)
+			origInfo := getOrigInfo(newEdbInfo.Source, newEdbInfo.SubSource, newEdbInfo.EdbCode, newEdbInfo.EdbName)
 
 			pushIndexData = &PushIndexParamDataReq{
 				SourceIndexCode:  newEdbInfo.EdbCode,
@@ -599,8 +599,9 @@ type OrigInfo struct {
 // @param source int
 // @param subSource int
 // @param edbCode string
+// @param edbName string
 // @return origInfo OrigInfo
-func getOrigInfo(source, subSource int, edbCode string) (origInfo OrigInfo) {
+func getOrigInfo(source, subSource int, edbCode, edbName string) (origInfo OrigInfo) {
 	switch source {
 	case utils.DATA_SOURCE_THS, utils.DATA_SOURCE_WIND: // 同花顺、wind
 		origInfo.SourceName = "经济数据库"
@@ -624,6 +625,11 @@ func getOrigInfo(source, subSource int, edbCode string) (origInfo OrigInfo) {
 		origInfo.SourceName = edbInfo.Interface
 	}
 
+	// 如果原始名称为空,则使用ETA指标库的名称作为原始名称
+	if origInfo.EdbName == `` {
+		origInfo.EdbName = edbName
+	}
+
 	return
 }
 

+ 2 - 0
services/eta_bridge/xy.go

@@ -232,7 +232,9 @@ var lockSyncIndex sync.Mutex
 // @param cont context.Context
 // @return err error
 func SyncIndex(cont context.Context) (err error) {
+	fmt.Println(time.Now(), "准备同步")
 	lockSyncIndex.Lock()
+	fmt.Println(time.Now(), "开始同步")
 	defer func() {
 		if err != nil {
 			tips := "SyncIndex-定时同步ETA指标信息变更数据至第三方失败, ErrMsg:\n" + err.Error()