소스 검색

获取采购意向字段的值

Jianghan 1 년 전
부모
커밋
4e002e6234
3개의 변경된 파일31개의 추가작업 그리고 12개의 파일을 삭제
  1. 2 2
      CMPlatform/history/task.go
  2. 26 9
      CMPlatform/history/util_history.go
  3. 3 1
      CMPlatform/util/utiltag.go

+ 2 - 2
CMPlatform/history/task.go

@@ -370,7 +370,7 @@ func processedData_A(c *Customer, data *tempData) {
 	//先获取用到的所有字段值
 	fieldText := map[string]interface{}{}
 	for field, _ := range sr.Fields {
-		text := common.ObjToString(tmp[field])
+		text := GetFieldData(tmp, field)
 		text = ProcessData(text) //处理文本(字母转大写,删除一些符号)
 		fieldText[field] = text
 	}
@@ -543,7 +543,7 @@ func TagRuleFuc(appid string, pushModel, tag int, rules []*TagRule, sr *SearchRu
 			//先获取用到的所有字段值
 			for field, _ := range tr.Fields {
 				if fieldText[field] == nil { //补充fieldText
-					text := common.ObjToString(tmp[field])
+					text := GetFieldData(tmp, field)
 					text = ProcessData(text) //处理文本(字母转大写,删除一些符号)
 					fieldText[field] = text
 				}

+ 26 - 9
CMPlatform/history/util_history.go

@@ -30,15 +30,18 @@ var Gmails []*mail.GmailAuth
 
 // 匹配方式map
 var MatchType = map[string]interface{}{
-	"1": "title",
-	"2": "detail",
-	"3": "purchasing",
-	"4": "filetext",
-	"5": "projectname",
-	"6": "buyer",
-	"7": "s_winner",
-	"8": "buyer",
-	"9": "s_winner",
+	"1":  "title",
+	"2":  "detail",
+	"3":  "purchasing",
+	"4":  "filetext",
+	"5":  "projectname",
+	"6":  "buyer",
+	"7":  "s_winner",
+	"8":  "buyer",
+	"9":  "s_winner",
+	"10": "procurementlist.projectname",
+	"11": "procurementlist.projectscope",
+	"12": "procurementlist.buyer",
 }
 
 var TtFieldMap = map[string]string{
@@ -348,6 +351,20 @@ func GetIdRange() (bson.M, bool) {
 
 }
 
+func GetFieldData(tmp map[string]interface{}, field string) string {
+	if strings.Contains(field, "procurementlist.") {
+		text := ""
+		field = strings.ReplaceAll(field, "procurementlist.", "")
+		for _, pm := range tmp["procurementlist"].([]interface{}) {
+			pm1 := pm.(map[string]interface{})
+			text += common.ObjToString(pm1[field])
+		}
+		return text
+	} else {
+		return common.ObjToString(tmp[field])
+	}
+}
+
 // 处理文本
 func ProcessData(text string) string {
 	defer common.Catch()

+ 3 - 1
CMPlatform/util/utiltag.go

@@ -5,6 +5,7 @@ import (
 	"app.yhyue.com/moapp/jybase/encrypt"
 	elastic "app.yhyue.com/moapp/jybase/es"
 	"app.yhyue.com/moapp/jybase/log"
+	"cmplatform/history"
 	"cmplatform/models"
 	sql "cmplatform/util/sqlmodel"
 	"context"
@@ -247,7 +248,8 @@ func searchData(index, esquery, sdataid string, i_maxnum int64, tags map[string]
 						}
 					}
 					for _, filed := range fileds {
-						filed1 := strings.ToLower(common.ObjToString(item[filed]))
+						filed1 := history.GetFieldData(item, filed)
+						filed1 = history.ProcessData(filed1)
 						ddds := d.Analy(filed1)
 						analyKeys = append(analyKeys, ddds...)
 					}