Ver código fonte

Merge branch 'cygx_10.6' of http://8.136.199.33:3000/hongze/hongze_cygx into debug

xingzai 1 ano atrás
pai
commit
7114b47056
3 arquivos alterados com 385 adições e 67 exclusões
  1. 11 9
      controllers/search.go
  2. 360 46
      services/es_comprehensive.go
  3. 14 12
      utils/elastic.go

+ 11 - 9
controllers/search.go

@@ -670,15 +670,14 @@ func (this *SearchController) ListHomeArtAndChartPage() {
 		}
 	}
 	//记录用户搜索关键词
-	var source int
-	if listType == 1 {
-		source = 3
-	} else if listType == 2 {
-		source = 1
-	} else {
-		source = 2
-	}
-	go services.AddSearchKeyWord(user, keyWord, source)
+	//var source int
+	//if listType == 1 {
+	//	source = 3
+	//} else if listType == 2 {
+	//	source = 1
+	//} else {
+	//	source = 2
+	//}
 
 	if chartTotal > int(total) {
 		total = int64(chartTotal)
@@ -749,6 +748,9 @@ func (this *SearchController) ComprehensiveList() {
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()
 		return
 	}
+	if currentIndex == 1 {
+		go services.AddSearchKeyWord(user, keyWord, 1)
+	}
 
 	resp.List = list
 	page := paging.GetPaging(currentIndex, pageSize, int(tmpTotalResult))

+ 360 - 46
services/es_comprehensive.go

@@ -46,6 +46,7 @@ type ElasticComprehensiveDetail struct {
 }
 
 //func init() {
+//	//AddComprehensiveIndustrialSource("Hz", 0)
 //	AddComprehensiveRoadshow()
 //}
 
@@ -128,12 +129,12 @@ func AddComprehensiveChart(chartId int) {
 }
 
 // 添加产业资源包
-func AddComprehensiveIndustrialSource() {
+func AddComprehensiveIndustrialSource(sourceType string, articleId int) {
 	var err error
 	defer func() {
 		if err != nil {
 			fmt.Println(err)
-			go utils.SendAlarmMsg("删除数据综合页面数据Es失败"+err.Error(), 2)
+			go utils.SendAlarmMsg("AddComprehensiveIndustrialSource"+err.Error(), 2)
 		}
 	}()
 	var condition string
@@ -147,6 +148,17 @@ func AddComprehensiveIndustrialSource() {
 	for _, v := range listsubject {
 		mapActivitySubject[v.IndustrialManagementId] = append(mapActivitySubject[v.IndustrialManagementId], v.SubjectName)
 	}
+	var industrialsource string
+	if sourceType == "Hz" {
+		condition = " AND a.article_type_id  = 0  " // 弘则资源包
+		industrialsource = "industrialsourceHz"
+	} else {
+		condition = " AND a.article_type_id  > 0  " //研选资源包
+		industrialsource = "industrialsourceYx"
+	}
+	if articleId > 0 {
+		condition += "  AND a.article_id = " + strconv.Itoa(articleId)
+	}
 	list, err := models.GetSearchResourceList(0, condition, 0, 0)
 	if err != nil {
 		fmt.Println(err)
@@ -156,10 +168,10 @@ func AddComprehensiveIndustrialSource() {
 	for _, v := range list {
 		item := new(ElasticComprehensiveDetail)
 		item.SourceId = v.IndustrialManagementId
-		item.Source = "industrialsource"
+		item.Source = industrialsource
 		item.IndustryName = v.IndustryName
 		item.SubjectNames = strings.Join(mapActivitySubject[v.IndustrialManagementId], ",")
-		item.PublishDate = v.PublishDate
+		item.PublishDate = v.PublishDate + " 00:00:00"
 		EsAddOrEditComprehensiveData(item)
 		fmt.Println(item)
 	}
@@ -574,7 +586,7 @@ func EsAddOrEditComprehensiveData(item *ElasticComprehensiveDetail) (err error)
 		var script string
 		script += fmt.Sprint("ctx._source['SubjectNames'] = '", item.SubjectNames, "';")
 		script += fmt.Sprint("ctx._source['PublishDate'] = '", item.PublishDate, "';")
-		script += fmt.Sprint("ctx._source['IsSummary'] = '", item.IsSummary, "';")
+		script += fmt.Sprint("ctx._source['IsSummary'] = ", item.IsSummary, ";")
 		script += fmt.Sprint("ctx._source['Abstract'] = '", item.Abstract, "';")
 		script += fmt.Sprint("ctx._source['Title'] = '", item.Title, "';")
 		script += fmt.Sprint("ctx._source['BodyText'] = '", item.BodyText, "';")
@@ -622,11 +634,245 @@ func EsDeleteComprehensiveData(item *ElasticComprehensiveDetail) (err error) {
 	return
 }
 
+//func EsComprehensiveSearch(keyWord string, startSize, pageSize int) (result []*SearchComprehensiveItem, total int64, err error) {
+//	indexName := utils.IndexNameComprehensive
+//	client := utils.Client
+//	var keyWordArr []string
+//	keyWordArr = append(keyWordArr, keyWord)
+//
+//	//Es 的高级查询有 自定义排序 文档一时半会儿撸不懂,先做多次查询手动过滤 2023.2.2
+//	//ikType 查询方式 ,0:查所有 、 1:查询键入词 、 2:查询除了查询键入词之外的联想词
+//	mustMap := make([]interface{}, 0)
+//	shouldMap := make(map[string]interface{}, 0)
+//	shouldMapquery := make([]interface{}, 0)
+//
+//	mustNotMap := make([]interface{}, 0)
+//	shouldNotMap := make(map[string]interface{}, 0)
+//	shouldNotMapquery := make([]interface{}, 0)
+//	var boost int
+//	//lenkeyWordArr := len(keyWordArr)
+//	for k, v := range keyWordArr {
+//		if k > 0 {
+//			continue
+//		}
+//		if k == 0 {
+//			boost = 2 * 1000
+//		} else {
+//			boost = 1
+//		}
+//
+//		if v != "" {
+//			shouldMapquery = append(shouldMapquery, map[string]interface{}{
+//				"function_score": map[string]interface{}{
+//					"query": map[string]interface{}{
+//						"multi_match": map[string]interface{}{
+//							//"boost":  (lenkeyWordArr - k) * boost, //给查询的值赋予权重
+//							"boost":  boost, //给查询的值赋予权重
+//							"fields": []interface{}{"Title"},
+//							"query":  v,
+//						},
+//					},
+//				},
+//			})
+//			shouldMapquery = append(shouldMapquery, map[string]interface{}{
+//				"function_score": map[string]interface{}{
+//					"query": map[string]interface{}{
+//						"multi_match": map[string]interface{}{
+//							"boost":  boost, //给查询的值赋予权重
+//							"fields": []interface{}{"Abstract"},
+//							"query":  v,
+//						},
+//					},
+//				},
+//			})
+//			shouldMapquery = append(shouldMapquery, map[string]interface{}{
+//				"function_score": map[string]interface{}{
+//					"query": map[string]interface{}{
+//						"multi_match": map[string]interface{}{
+//							"boost":  boost, //给查询的值赋予权重
+//							"fields": []interface{}{"Annotation"},
+//							"query":  v,
+//						},
+//					},
+//				},
+//			})
+//
+//			shouldMapquery = append(shouldMapquery, map[string]interface{}{
+//				"function_score": map[string]interface{}{
+//					"query": map[string]interface{}{
+//						"multi_match": map[string]interface{}{
+//							//"boost":  (lenkeyWordArr-k)*boost - 1, //给查询的值赋予权重
+//							"boost":  boost, //给查询的值赋予权重
+//							"fields": []interface{}{"BodyText"},
+//							"query":  v,
+//						},
+//					},
+//				},
+//			})
+//
+//			shouldMapquery = append(shouldMapquery, map[string]interface{}{
+//				"function_score": map[string]interface{}{
+//					"query": map[string]interface{}{
+//						"multi_match": map[string]interface{}{
+//							//"boost":  (lenkeyWordArr-k)*boost - 1, //给查询的值赋予权重
+//							"boost":  boost, //给查询的值赋予权重
+//							"fields": []interface{}{"IndustryName"},
+//							"query":  v,
+//						},
+//					},
+//				},
+//			})
+//
+//			shouldMapquery = append(shouldMapquery, map[string]interface{}{
+//				"function_score": map[string]interface{}{
+//					"query": map[string]interface{}{
+//						"multi_match": map[string]interface{}{
+//							//"boost":  (lenkeyWordArr-k)*boost - 1, //给查询的值赋予权重
+//							"boost":  boost, //给查询的值赋予权重
+//							"fields": []interface{}{"SubjectNames"},
+//							"query":  v,
+//						},
+//					},
+//				},
+//			})
+//		}
+//	}
+//	shouldMap = map[string]interface{}{
+//		"should": shouldMapquery,
+//	}
+//
+//	shouldNotMap = map[string]interface{}{
+//		"should": shouldNotMapquery,
+//	}
+//	//排序
+//	sortMap := make([]interface{}, 0)
+//
+//	//时间
+//	sortMap = append(sortMap, map[string]interface{}{
+//		"PublishDate": map[string]interface{}{
+//			"order": "desc",
+//		},
+//	})
+//	//sortMap = append(sortMap, map[string]interface{}{
+//	//	"_score": map[string]interface{}{
+//	//		"order": "desc",
+//	//	},
+//	//})
+//	//高亮
+//	highlightMap := make(map[string]interface{}, 0)
+//	highlightMap = map[string]interface{}{
+//		"fields": map[string]interface{}{
+//			"BodyText":   map[string]interface{}{},
+//			"Title":      map[string]interface{}{},
+//			"Abstract":   map[string]interface{}{},
+//			"Annotation": map[string]interface{}{},
+//		},
+//		//样式 红色
+//		"post_tags":     []interface{}{"</font>"},
+//		"pre_tags":      []interface{}{"<font color='red'>"},
+//		"fragment_size": 50,
+//	}
+//
+//	mustMap = append(mustMap, map[string]interface{}{
+//		"bool": shouldMap,
+//	})
+//
+//	mustNotMap = append(mustNotMap, map[string]interface{}{
+//		"term": shouldNotMap,
+//	})
+//	//mustMap = append(mustMap, map[string]interface{}{
+//	//	"term": map[string]interface{}{
+//	//		"IsSummary": "1",
+//	//	},
+//	//})
+//	queryMap := map[string]interface{}{
+//		"query": map[string]interface{}{
+//			"bool": map[string]interface{}{
+//				"must": mustMap,
+//			},
+//		},
+//	}
+//
+//	queryMap["sort"] = sortMap
+//	queryMap["from"] = startSize
+//	queryMap["size"] = pageSize
+//	queryMap["highlight"] = highlightMap
+//	//jsonBytes, _ := json.Marshal(queryMap)
+//	//fmt.Println(string(jsonBytes))
+//	//utils.FileLog.Info(string(jsonBytes))
+//	request := client.Search(indexName).Source(queryMap) // sets the JSON request
+//	searchByMatch, err := request.Do(context.Background())
+//	if searchByMatch != nil {
+//		if searchByMatch.Hits != nil {
+//			for _, v := range searchByMatch.Hits.Hits {
+//				var isAppend bool
+//				articleJson, err := v.Source.MarshalJSON()
+//				if err != nil {
+//					return nil, 0, err
+//				}
+//				article := new(ElasticComprehensiveDetail)
+//				err = json.Unmarshal(articleJson, &article)
+//				if err != nil {
+//					return nil, 0, err
+//				}
+//				//fmt.Println(article.SourceId, article.Title, article.Source)
+//				searchItem := new(SearchComprehensiveItem)
+//				searchItem.SourceId = article.SourceId
+//				if len(v.Highlight["Annotation"]) > 0 {
+//					for _, vText := range v.Highlight["Annotation"] {
+//						searchItem.Body = append(searchItem.Body, vText)
+//					}
+//				}
+//				if len(v.Highlight["Abstract"]) > 0 {
+//					for _, vText := range v.Highlight["Abstract"] {
+//						searchItem.Body = append(searchItem.Body, vText)
+//					}
+//				}
+//				if len(v.Highlight["BodyText"]) > 0 {
+//					for _, vText := range v.Highlight["BodyText"] {
+//						searchItem.Body = append(searchItem.Body, vText)
+//					}
+//				}
+//				searchItem.IsSummary = article.IsSummary
+//				if len(searchItem.Body) == 0 {
+//					bodyRune := []rune(article.BodyText)
+//					bodyRuneLen := len(bodyRune)
+//					if bodyRuneLen > 100 {
+//						bodyRuneLen = 100
+//					}
+//					body := string(bodyRune[:bodyRuneLen])
+//					searchItem.Body = []string{body}
+//				}
+//				var title string
+//				if len(v.Highlight["Title"]) > 0 {
+//					title = v.Highlight["Title"][0]
+//				} else {
+//					title = article.Title
+//				}
+//				searchItem.Title = title
+//				searchItem.Source = article.Source
+//				searchItem.PublishDate = article.PublishDate
+//
+//				if !isAppend {
+//					result = append(result, searchItem)
+//				}
+//			}
+//		}
+//		total = searchByMatch.Hits.TotalHits.Value
+//	}
+//	return
+//}
+
 func EsComprehensiveSearch(keyWord string, startSize, pageSize int) (result []*SearchComprehensiveItem, total int64, err error) {
 	indexName := utils.IndexNameComprehensive
 	client := utils.Client
-	var keyWordArr []string
-	keyWordArr = append(keyWordArr, keyWord)
+	keyWordArr, err := GetIndustryMapNameSliceV3(keyWord)
+	keyWordArr = RemoveDuplicatesAndEmpty(keyWordArr)
+	keyWordLen := len(keyWordArr)
+	if keyWordLen <= 0 {
+		keyWordArr = append(keyWordArr, keyWord)
+		keyWordLen = len(keyWordArr)
+	}
 
 	//Es 的高级查询有 自定义排序 文档一时半会儿撸不懂,先做多次查询手动过滤 2023.2.2
 	//ikType 查询方式 ,0:查所有 、 1:查询键入词 、 2:查询除了查询键入词之外的联想词
@@ -637,6 +883,8 @@ func EsComprehensiveSearch(keyWord string, startSize, pageSize int) (result []*S
 	mustNotMap := make([]interface{}, 0)
 	shouldNotMap := make(map[string]interface{}, 0)
 	shouldNotMapquery := make([]interface{}, 0)
+	// @Param   OrderColumn   query   int  true       "排序字段 ,Comprehensive综合 ,Matching匹配度 ,PublishDate 发布时间 "
+	//keyWordWeight := GetWeight(keyWordLen)
 	var boost int
 	//lenkeyWordArr := len(keyWordArr)
 	for k, v := range keyWordArr {
@@ -685,18 +933,18 @@ func EsComprehensiveSearch(keyWord string, startSize, pageSize int) (result []*S
 				},
 			})
 
-			shouldMapquery = append(shouldMapquery, map[string]interface{}{
-				"function_score": map[string]interface{}{
-					"query": map[string]interface{}{
-						"multi_match": map[string]interface{}{
-							//"boost":  (lenkeyWordArr-k)*boost - 1, //给查询的值赋予权重
-							"boost":  boost, //给查询的值赋予权重
-							"fields": []interface{}{"BodyText"},
-							"query":  v,
-						},
-					},
-				},
-			})
+			//shouldMapquery = append(shouldMapquery, map[string]interface{}{
+			//	"function_score": map[string]interface{}{
+			//		"query": map[string]interface{}{
+			//			"multi_match": map[string]interface{}{
+			//				//"boost":  (lenkeyWordArr-k)*boost - 1, //给查询的值赋予权重
+			//				"boost":  boost, //给查询的值赋予权重
+			//				"fields": []interface{}{"BodyText"},
+			//				"query":  v,
+			//			},
+			//		},
+			//	},
+			//})
 
 			shouldMapquery = append(shouldMapquery, map[string]interface{}{
 				"function_score": map[string]interface{}{
@@ -750,7 +998,7 @@ func EsComprehensiveSearch(keyWord string, startSize, pageSize int) (result []*S
 	highlightMap := make(map[string]interface{}, 0)
 	highlightMap = map[string]interface{}{
 		"fields": map[string]interface{}{
-			"BodyText":   map[string]interface{}{},
+			//"BodyText":   map[string]interface{}{},
 			"Title":      map[string]interface{}{},
 			"Abstract":   map[string]interface{}{},
 			"Annotation": map[string]interface{}{},
@@ -764,15 +1012,10 @@ func EsComprehensiveSearch(keyWord string, startSize, pageSize int) (result []*S
 	mustMap = append(mustMap, map[string]interface{}{
 		"bool": shouldMap,
 	})
-
 	mustNotMap = append(mustNotMap, map[string]interface{}{
-		"term": shouldNotMap,
+		"bool": shouldNotMap,
 	})
-	//mustMap = append(mustMap, map[string]interface{}{
-	//	"term": map[string]interface{}{
-	//		"IsSummary": "1",
-	//	},
-	//})
+
 	queryMap := map[string]interface{}{
 		"query": map[string]interface{}{
 			"bool": map[string]interface{}{
@@ -821,7 +1064,7 @@ func EsComprehensiveSearch(keyWord string, startSize, pageSize int) (result []*S
 						searchItem.Body = append(searchItem.Body, vText)
 					}
 				}
-				searchItem.IsSummary = article.IsSummary
+				//searchItem.IsSummary = article.IsSummary
 				if len(searchItem.Body) == 0 {
 					bodyRune := []rune(article.BodyText)
 					bodyRuneLen := len(bodyRune)
@@ -864,14 +1107,14 @@ func GetResourceDataEsList(list []*SearchComprehensiveItem, user *models.WxUserI
 		item := new(models.CygxResourceDataResp)
 		item.SourceId = v.SourceId
 		item.Source = v.Source
-		if v.IsSummary == 1 {
-			item.BodyHighlight = v.Body
-			titleHighlight[v.SourceId] = v.Title
-			bodyHighlight[v.SourceId] = v.Body
-			//fmt.Println(v.Title)
-		} else {
-			item.BodyHighlight = make([]string, 0)
-		}
+		//if v.IsSummary == 1 {
+		item.BodyHighlight = v.Body
+		titleHighlight[v.SourceId] = v.Title
+		bodyHighlight[v.SourceId] = v.Body
+		//fmt.Println(v.Title)
+		//} else {
+		//	item.BodyHighlight = make([]string, 0)
+		//}
 		item.PublishDate = utils.TimeRemoveHms2(v.PublishDate)
 		mapItems[fmt.Sprint(v.Source, v.SourceId)] = item
 	}
@@ -887,7 +1130,8 @@ func GetResourceDataEsList(list []*SearchComprehensiveItem, user *models.WxUserI
 	var minutessummaryIds []int
 	var meetingreviewchaptIds []int
 	var productinteriorIds []int
-	var industrialResourceIds []int
+	var industrialResourceIdsHz []int // 弘则产业资源包
+	var industrialResourceIdsYx []int // 研选产业资源包
 	//Source      string    `description:"资源类型 报告 :article 、图表 :newchart、微路演 :roadshow、活动 :activity、活动视频:activityvideo、活动音频:activityvoice、专项调研活动:activityspecial 、 本周研究汇总: researchsummary 、 上周纪要汇总 :minutessummary 、晨会精华 :meetingreviewchapt "`
 	for _, v := range list {
 		if v.Source == "article" {
@@ -912,8 +1156,10 @@ func GetResourceDataEsList(list []*SearchComprehensiveItem, user *models.WxUserI
 			meetingreviewchaptIds = append(meetingreviewchaptIds, v.SourceId)
 		} else if v.Source == "productinterior" {
 			productinteriorIds = append(productinteriorIds, v.SourceId)
-		} else if v.Source == "industrialsource" {
-			industrialResourceIds = append(industrialResourceIds, v.SourceId)
+		} else if v.Source == "industrialsourceHz" {
+			industrialResourceIdsHz = append(industrialResourceIdsHz, v.SourceId)
+		} else if v.Source == "industrialResourceIdsYx" {
+			industrialResourceIdsHz = append(industrialResourceIdsYx, v.SourceId)
 		}
 
 	}
@@ -1051,7 +1297,6 @@ func GetResourceDataEsList(list []*SearchComprehensiveItem, user *models.WxUserI
 		mapChart[chartName] = imgUrlChart
 	}
 	var imgUrlResp string
-	fmt.Println(activityIds)
 	//处理活动
 	if len(activityIds) > 0 {
 		for _, vss := range activityIds {
@@ -1099,22 +1344,56 @@ func GetResourceDataEsList(list []*SearchComprehensiveItem, user *models.WxUserI
 	}
 
 	//产业资源包
-	if len(industrialResourceIds) > 0 {
+	if len(industrialResourceIdsHz) > 0 {
+		pars = make([]interface{}, 0)
+
+		var industrialResourceIdstring []string
+		for _, v := range industrialResourceIdsHz {
+			industrialResourceIdstring = append(industrialResourceIdstring, strconv.Itoa(v))
+		}
+		industrialId := strings.Join(industrialResourceIdstring, ",")
+		condition = ` AND  m.industrial_management_id IN  (` + industrialId + `)   AND a.article_type = 0 `
+		listIndustrialResourceIds, e := models.GetSearchResourceList(user.UserId, condition, 0, len(industrialResourceIdsHz))
+		if e != nil {
+			err = errors.New("GetSearchResourceList, Err: " + e.Error())
+			return
+		}
+		//合并产业关联的标的
+		listSubjcet, e := models.GetIndustrialSubjectAllByIndustrialId(industrialResourceIdsHz)
+		if e != nil {
+			e = errors.New("GetIndustrialSubjectAllByIndustrialId, Err: " + e.Error())
+			return
+		}
+		mapIndustrial := make(map[string]int)
+		for _, v := range listSubjcet {
+			for k2, v2 := range listIndustrialResourceIds {
+				if v2.IndustrialManagementId == v.IndustrialManagementId && mapIndustrial[fmt.Sprint(v2.IndustrialManagementId, "Hz", v.SubjectName)] == 0 {
+					listIndustrialResourceIds[k2].IndustrialSubjectList = append(listIndustrialResourceIds[k2].IndustrialSubjectList, v)
+				}
+			}
+		}
+		for _, v := range listIndustrialResourceIds {
+			v.Source = 1
+			mapItems[fmt.Sprint("industrialsourceHz", v.IndustrialManagementId)].IndustrialResource = v
+		}
+	}
+
+	if len(industrialResourceIdsYx) > 0 {
 		pars = make([]interface{}, 0)
 
 		var industrialResourceIdstring []string
-		for _, v := range industrialResourceIds {
+		for _, v := range industrialResourceIdsYx {
 			industrialResourceIdstring = append(industrialResourceIdstring, strconv.Itoa(v))
 		}
 		industrialId := strings.Join(industrialResourceIdstring, ",")
-		condition = ` AND  m.industrial_management_id IN  (` + industrialId + `) `
-		listIndustrialResourceIds, e := models.GetSearchResourceList(user.UserId, condition, 0, len(industrialResourceIds))
+		condition = ` AND  m.industrial_management_id IN  (` + industrialId + `)   AND a.article_type > 0 `
+		listIndustrialResourceIds, e := models.GetSearchResourceList(user.UserId, condition, 0, len(industrialResourceIdsYx))
 		if e != nil {
 			err = errors.New("GetSearchResourceList, Err: " + e.Error())
 			return
 		}
 		//合并产业关联的标的
-		listSubjcet, e := models.GetIndustrialSubjectAllByIndustrialId(industrialResourceIds)
+		listSubjcet, e := models.GetIndustrialSubjectAllByIndustrialId(industrialResourceIdsYx)
 		if e != nil {
 			e = errors.New("GetIndustrialSubjectAllByIndustrialId, Err: " + e.Error())
 			return
@@ -1128,7 +1407,8 @@ func GetResourceDataEsList(list []*SearchComprehensiveItem, user *models.WxUserI
 			}
 		}
 		for _, v := range listIndustrialResourceIds {
-			mapItems[fmt.Sprint("industrialsource", v.IndustrialManagementId)].IndustrialResource = v
+			v.Source = 2
+			mapItems[fmt.Sprint("industrialsourceYx", v.IndustrialManagementId)].IndustrialResource = v
 		}
 	}
 
@@ -1310,12 +1590,46 @@ func GetResourceDataEsList(list []*SearchComprehensiveItem, user *models.WxUserI
 			}
 		}
 	}
+
 	for _, vList := range list {
 		for _, v := range mapItems {
 			//如果这些类型都为空,那么就不合并
 			if v.Article == nil && v.Newchart == nil && v.Roadshow == nil && v.Activity == nil && v.Activityvideo == nil && v.Activityvoice == nil && v.Activityspecial == nil && v.Researchsummary == nil && v.Minutessummary == nil && v.Meetingreviewchapt == nil && v.ProductInterior == nil && v.IndustrialResource == nil {
 				continue
 			}
+			if v.Article != nil {
+				v.Article.Title = vList.Title
+			}
+			if v.Newchart != nil {
+				v.Newchart.Title = vList.Title
+			}
+			if v.Roadshow != nil {
+				v.Roadshow.Title = vList.Title
+			}
+			if v.Activity != nil {
+				v.Activity.ActivityName = vList.Title
+			}
+			if v.Activityvideo != nil {
+				v.Activityvideo.Title = vList.Title
+			}
+			if v.Activityvoice != nil {
+				v.Activityvoice.Title = vList.Title
+			}
+			if v.Activityspecial != nil {
+				v.Activityspecial.ResearchTheme = vList.Title
+			}
+			if v.Researchsummary != nil {
+				v.Researchsummary.Title = vList.Title
+			}
+			if v.Minutessummary != nil {
+				v.Minutessummary.Title = vList.Title
+			}
+			if v.ProductInterior != nil {
+				v.ProductInterior.Title = vList.Title
+			}
+			if v.IndustrialResource != nil {
+				v.Source = "industrialsource"
+			}
 			if v.SourceId == vList.SourceId {
 				items = append(items, v)
 			}

+ 14 - 12
utils/elastic.go

@@ -2,6 +2,8 @@ package utils
 
 import (
 	"github.com/olivere/elastic/v7"
+	"log"
+	"os"
 	"time"
 )
 
@@ -14,21 +16,21 @@ const (
 )
 
 func init() {
-	//errorlog := log.New(os.Stdout, "APP", log.LstdFlags)
-	//file := ""
-	//if RunMode == "release" {
-	//	//file = `/data/rdlucklog/hongze_cygx/eslog.log`
-	//	file = `./rdlucklog/eslog.log`
-	//} else {
-	//	file = `./rdlucklog/eslog.log`
-	//}
-	//logFile, _ := os.OpenFile(file, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0766)
+	errorlog := log.New(os.Stdout, "APP", log.LstdFlags)
+	file := ""
+	if RunMode == "release" {
+		//file = `/data/rdlucklog/hongze_cygx/eslog.log`
+		file = `./rdlucklog/eslog.log`
+	} else {
+		file = `./rdlucklog/eslog.log`
+	}
+	logFile, _ := os.OpenFile(file, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0766)
 	client, err := elastic.NewClient(
 		elastic.SetURL(ES_URL),
 		elastic.SetBasicAuth(ES_USERNAME, ES_PASSWORD),
-		//elastic.SetTraceLog(log.New(logFile, "ES-TRACE: ", 0)),
-		//elastic.SetSniff(false), elastic.SetErrorLog(errorlog))
-		elastic.SetSniff(false))
+		elastic.SetTraceLog(log.New(logFile, "ES-TRACE: ", 0)),
+		elastic.SetSniff(false), elastic.SetErrorLog(errorlog))
+	//elastic.SetSniff(false))
 	Client = client
 	if err != nil {
 		go SendAlarmMsg("ElasticSearch连接失败", 2)