ソースを参照

wip:关键词处理

wangshan 5 ヶ月 前
コミット
cb76aa1b60
1 ファイル変更16 行追加2 行削除
  1. 16 2
      marketanalysis/marketanalysis.go

+ 16 - 2
marketanalysis/marketanalysis.go

@@ -184,13 +184,27 @@ func (a *AnalysisEntity) ForMatData() error {
 		for j := 0; j < len(items.A_Key); j++ {
 			AKey := items.A_Key[j]
 			if len(AKey.Keyword) > 0 {
-				flag = true
-				break
+				var keys []string
+				for _, kv := range AKey.Keyword {
+					if strings.TrimSpace(kv) != "" {
+						keys = append(keys, kv)
+					}
+				}
+				AKey.Keyword = []string{}
+				if len(keys) > 0 {
+					AKey.Keyword = keys
+					flag = true
+					break
+				}
+			}
+			if len(AKey.Keyword) == 0 {
+				items.A_Key = append(items.A_Key[:j], items.A_Key[j+1:]...)
 			}
 		}
 		if flag {
 			break
 		}
+		a.FormatParam.KeysItems = append(a.FormatParam.KeysItems[:i], a.FormatParam.KeysItems[i+1:]...)
 	}
 	if !flag {
 		return fmt.Errorf("请选择关键词组")