Parcourir la source

wip:标题处理

wangshan il y a 8 mois
Parent
commit
7f6b207050
2 fichiers modifiés avec 15 ajouts et 3 suppressions
  1. 1 1
      jyBXCore/rpc/model/es/es.go
  2. 14 2
      jyBXCore/rpc/service/purchase.go

+ 1 - 1
jyBXCore/rpc/model/es/es.go

@@ -44,7 +44,7 @@ const (
 	//直采-采购信息
 	PurchaseType              = "bidding_yg"
 	PurchaseIndex             = "bidding_yg"
-	PurchaseBaseField         = `"_id","source_id","title","area","city","district","buyerclass","publishtime","isValidFile","budget","bidamount","signendtime","deliver_area","deliver_city","deliver_district","buyer","buyertel","s_subscopeclass","public_type","purchasing","spidercode","subtype"` //"purchasinglist","projectname",
+	PurchaseBaseField         = `"_id","source_id","title","area","city","district","buyerclass","publishtime","isValidFile","budget","bidamount","signendtime","deliver_area","deliver_city","deliver_district","buyer","buyertel","s_subscopeclass","public_type","purchasing","spidercode","purchasinglist","projectname","subtype"` //
 	PurchaseSearchSort        = `{"publishtime":-1}`
 	PurchaseBaseFieldForPayer = PurchaseBaseField + `,"buyerperson","agency","agencytel","agencyperson","s_winner","winnertel","winnerperson","bidendtime","projectinfo","entidlist"`
 )

+ 14 - 2
jyBXCore/rpc/service/purchase.go

@@ -153,6 +153,10 @@ func (p *Purchase) HistoryKeywords() {
 	}
 }
 
+var (
+	titleSuffix = "%s等"
+)
+
 // 格式化
 func (p *Purchase) PurchaseListFormat(res []map[string]interface{}) (list []*bxcore.PurchaseList) {
 	for _, rv := range res {
@@ -178,12 +182,20 @@ func (p *Purchase) PurchaseListFormat(res []map[string]interface{}) (list []*bxc
 				}
 			}
 			if len([]rune(title)) > 50 {
-				title = string([]rune(title)[:50])
+				title = fmt.Sprintf(titleSuffix, string([]rune(title)[:50]))
 			}
 			if lastPart != "" {
 				title = fmt.Sprintf("%s%s%s", title, splitStr, lastPart)
 			}
 		}
+		publicType := MC.InterfaceToStr(rv["public_type"])
+		originalTitle := title
+		if publicType == "平台发布" && rv["purchasinglist"] != nil {
+			purchasingList := MC.ObjArrToMapArr(rv["purchasinglist"].([]interface{}))
+			if len(purchasingList) > 1 {
+				originalTitle = fmt.Sprintf(titleSuffix, originalTitle)
+			}
+		}
 		regionUrl := ""
 		if district != "" && IC.DistrictMap[district] != "" {
 			regionUrl = fmt.Sprintf(AreaLabelLink, "city", IC.DistrictMap[district])
@@ -257,7 +269,7 @@ func (p *Purchase) PurchaseListFormat(res []map[string]interface{}) (list []*bxc
 			Industry:      util.IndustryFormat(p.Industry, strings.Trim(MC.ObjToString(rv["s_subscopeclass"]), ",")),
 			PublicType:    MC.InterfaceToStr(rv["public_type"]),
 			IsNew:         MC.Int64All(rv["is_yg_new"]), //is_yg_new==1 新的网站来源
-			OriginalTitle: MC.InterfaceToStr(rv["title"]),
+			OriginalTitle: originalTitle,
 			//BuyerPerson:  buyerPerson,
 			//Agency:       agency,
 			//AgencyTel:    agencyTel,