瀏覽代碼

粮油商务网数据对接-代码优化

gmy 4 月之前
父節點
當前提交
1635a091bd
共有 2 個文件被更改,包括 5 次插入1 次删除
  1. 1 1
      services/liangyou/commodity_liangyou.go
  2. 4 0
      services/liangyou/processor_business_logic.go

+ 1 - 1
services/liangyou/commodity_liangyou.go

@@ -436,7 +436,7 @@ func processReport(ctx context.Context, product string, category string, reportU
 		}
 		if len(baseFromLyDataList) > 0 {
 			for _, baseFromLyData := range baseFromLyDataList {
-				if baseFromLyData.DataTime != "" && baseFromLyData.IndexCode != "" {
+				if baseFromLyData.DataTime != "" && baseFromLyData.IndexCode != "" && baseFromLyData.IndexCode != "lysww" {
 					baseFromLyData.CreateTime = utils.GetCurrentTime()
 					baseFromLyData.ModifyTime = utils.GetCurrentTime()
 					lyIndexDataList = append(lyIndexDataList, baseFromLyData)

+ 4 - 0
services/liangyou/processor_business_logic.go

@@ -1970,6 +1970,10 @@ func extractValueInParentheses(input string) (string, error) {
 
 // 获取指标id,根据指标名称判断,没有插入指标生成返回
 func getIndexId(indexCode string, indexName string, classifyId int, sourceName string, frequency string, unit string) (int, error) {
+	if indexCode == "lysww" {
+		return 0, fmt.Errorf("indexCode is error")
+	}
+
 	// 判断指标是否存在
 	var indexId int
 	indexInfo, err := models.GetLyIndexByCode(indexCode)