zqbao пре 3 месеци
родитељ
комит
95fbc3575e
1 измењених фајлова са 5 додато и 8 уклоњено
  1. 5 8
      services/knowledge/es.go

+ 5 - 8
services/knowledge/es.go

@@ -130,8 +130,6 @@ func SearchKnowledgeResourceByEs(resourceType int, keywordStr string, showSysIds
 		queryMap["sort"] = sortMap
 
 	}
-	jsonBytes, _ := json.Marshal(queryMap)
-	fmt.Println(string(jsonBytes))
 
 	request := client.Search(indexName).Source(queryMap) // sets the JSON request
 	searchMap := make(map[string]string)
@@ -140,9 +138,9 @@ func SearchKnowledgeResourceByEs(resourceType int, keywordStr string, showSysIds
 	if err != nil {
 		return
 	}
-	fmt.Println(searchResp)
-	fmt.Println(searchResp.Status)
 	if searchResp.Status != 0 {
+		jsonBytes, _ := json.Marshal(queryMap)
+		utils.FileLog.Info("search json:%s,SearchKnowledgeResourceByEs Status:%d", string(jsonBytes), searchResp.Status)
 		return
 	}
 
@@ -152,13 +150,13 @@ func SearchKnowledgeResourceByEs(resourceType int, keywordStr string, showSysIds
 				itemJson, tmpErr := v.Source.MarshalJSON()
 				if tmpErr != nil {
 					err = tmpErr
-					fmt.Println("movieJson err:", err)
+					utils.FileLog.Info("search json:%s,SearchKnowledgeResourceByEs Hits Source err:%s", string(itemJson), tmpErr.Error())
 					return
 				}
 				knowledgeItem := new(knowledge.KnowledgeResource)
 				tmpErr = json.Unmarshal(itemJson, &knowledgeItem)
 				if err != nil {
-					fmt.Println("json.Unmarshal chartInfoJson err:", err)
+					utils.FileLog.Info("json.Unmarshal KnowledgeResource err:%s", err.Error())
 					err = tmpErr
 					return
 				}
@@ -202,8 +200,7 @@ func EsAddOrEditKnowledgeResource(item *knowledge.KnowledgeResource) (err error)
 	response, err := request.Do(context.Background())
 	if err != nil {
 		jsonBytes, _ := json.Marshal(item)
-		fmt.Println("add json:", string(jsonBytes))
-		fmt.Println("EsAddOrEditKnowledgeResource err:", err)
+		utils.FileLog.Info("add json:%s,EsAddOrEditKnowledgeResource err:%s", string(jsonBytes), err.Error())
 		return
 	}
 	if response.Status == 0 {