Prechádzať zdrojové kódy

Merge branch 'dev/v4.8.27.4_wh' of qmx/jy into hotfix/v4.8.27.4

王浩 2 rokov pred
rodič
commit
4a15284d7b

+ 32 - 6
src/jfw/front/shorturl.go

@@ -1172,7 +1172,7 @@ func KeyWordHandle(obj map[string]interface{}) string {
 			}
 		}
 	}
-	if util.InterfaceToStr(obj["subtype"]) != "" {
+	if util.InterfaceToStr(obj["subtype"]) != "" && util.InterfaceToStr(obj["subtype"]) != "其它" {
 		keywordArr = append(keywordArr, TypeCodeMap[util.InterfaceToStr(obj["subtype"])])
 	}
 	if util.InterfaceToStr(obj["area"]) != "" {
@@ -1186,17 +1186,43 @@ func KeyWordHandle(obj map[string]interface{}) string {
 	return keyword
 }
 func DescriptionHandle(stype string, obj map[string]interface{}) string {
-	descriptionStr := ""
 	description := ""
 	pushTime := time.Unix(util.Int64All(obj["publishtime"]), 0)
 	if stype == "bdprivate" {
 		//bdprivate
 		//{项目标题},采购单位:{采购单位名称},成交供应商:{中标企业名称},公告日期:{公告日期}。
-		descriptionStr = "%s,采购单位1:%s,成交供应商:%s,公告日期:%s。"
-		description = fmt.Sprintf(descriptionStr, util.InterfaceToStr(obj["title"]), util.InterfaceToStr(obj["buyer"]), util.InterfaceToStr(obj["s_winner"]), pushTime.Format("2006年01月02日"))
+		descriptionArr := []string{}
+		if util.InterfaceToStr(obj["title"]) != "" {
+			descriptionArr = append(descriptionArr, util.InterfaceToStr(obj["title"]))
+		}
+		if util.InterfaceToStr(obj["buyer"]) != "" {
+			descriptionArr = append(descriptionArr, fmt.Sprintf("采购单位:%s", util.InterfaceToStr(obj["buyer"])))
+		}
+		if util.InterfaceToStr(obj["s_winner"]) != "" {
+			descriptionArr = append(descriptionArr, fmt.Sprintf("成交供应商:%s", util.InterfaceToStr(obj["s_winner"])))
+		}
+		if util.Int64All(obj["publishtime"]) != 0 {
+			descriptionArr = append(descriptionArr, fmt.Sprintf("公告日期:%s", pushTime.Format("2006年01月02日")))
+		}
+		description = strings.Join(descriptionArr, ",")
 	} else {
-		descriptionStr = "%s,项目所属地区是%s%s,项目采购单位是%s,项目发布时间是%s"
-		description = fmt.Sprintf(descriptionStr, util.InterfaceToStr(obj["title"]), util.InterfaceToStr(obj["area"]), util.InterfaceToStr(obj["city"]), util.InterfaceToStr(obj["buyer"]), pushTime.Format("2006年01月02日"))
+		//descriptionStr = "%s,项目所属地区是%s%s,项目采购单位是%s,项目发布时间是%s"
+		descriptionArr := []string{}
+		if util.InterfaceToStr(obj["title"]) != "" {
+			descriptionArr = append(descriptionArr, util.InterfaceToStr(obj["title"]))
+		}
+		area := util.InterfaceToStr(obj["area"])
+		city := util.InterfaceToStr(obj["city"])
+		if area != "" || city != "" {
+			descriptionArr = append(descriptionArr, fmt.Sprintf("项目所属地区是%s%s", area, city))
+		}
+		if util.InterfaceToStr(obj["buyer"]) != "" {
+			descriptionArr = append(descriptionArr, fmt.Sprintf("项目采购单位是%s", util.InterfaceToStr(obj["buyer"])))
+		}
+		if util.Int64All(obj["publishtime"]) != 0 {
+			descriptionArr = append(descriptionArr, fmt.Sprintf("项目发布时间是%s", pushTime.Format("2006年01月02日")))
+		}
+		description = strings.Join(descriptionArr, ",")
 	}
 	return description
 }

+ 32 - 6
src/jfw/modules/app/src/app/front/shorturl.go

@@ -660,7 +660,7 @@ func KeyWordHandle(obj map[string]interface{}) string {
 			}
 		}
 	}
-	if util.InterfaceToStr(obj["subtype"]) != "" {
+	if util.InterfaceToStr(obj["subtype"]) != "" && util.InterfaceToStr(obj["subtype"]) != "其它" {
 		keywordArr = append(keywordArr, TypeCodeMap[util.InterfaceToStr(obj["subtype"])])
 	}
 	if util.InterfaceToStr(obj["area"]) != "" {
@@ -674,17 +674,43 @@ func KeyWordHandle(obj map[string]interface{}) string {
 	return keyword
 }
 func DescriptionHandle(stype string, obj map[string]interface{}) string {
-	descriptionStr := ""
 	description := ""
 	pushTime := time.Unix(util.Int64All(obj["publishtime"]), 0)
 	if stype == "bdprivate" {
 		//bdprivate
 		//{项目标题},采购单位:{采购单位名称},成交供应商:{中标企业名称},公告日期:{公告日期}。
-		descriptionStr = "%s,采购单位1:%s,成交供应商:%s,公告日期:%s。"
-		description = fmt.Sprintf(descriptionStr, util.InterfaceToStr(obj["title"]), util.InterfaceToStr(obj["buyer"]), util.InterfaceToStr(obj["s_winner"]), pushTime.Format("2006年01月02日"))
+		descriptionArr := []string{}
+		if util.InterfaceToStr(obj["title"]) != "" {
+			descriptionArr = append(descriptionArr, util.InterfaceToStr(obj["title"]))
+		}
+		if util.InterfaceToStr(obj["buyer"]) != "" {
+			descriptionArr = append(descriptionArr, fmt.Sprintf("采购单位:%s", util.InterfaceToStr(obj["buyer"])))
+		}
+		if util.InterfaceToStr(obj["s_winner"]) != "" {
+			descriptionArr = append(descriptionArr, fmt.Sprintf("成交供应商:%s", util.InterfaceToStr(obj["s_winner"])))
+		}
+		if util.Int64All(obj["publishtime"]) != 0 {
+			descriptionArr = append(descriptionArr, fmt.Sprintf("公告日期:%s", pushTime.Format("2006年01月02日")))
+		}
+		description = strings.Join(descriptionArr, ",")
 	} else {
-		descriptionStr = "%s,项目所属地区是%s%s,项目采购单位是%s,项目发布时间是%s"
-		description = fmt.Sprintf(descriptionStr, util.InterfaceToStr(obj["title"]), util.InterfaceToStr(obj["area"]), util.InterfaceToStr(obj["city"]), util.InterfaceToStr(obj["buyer"]), pushTime.Format("2006年01月02日"))
+		//descriptionStr = "%s,项目所属地区是%s%s,项目采购单位是%s,项目发布时间是%s"
+		descriptionArr := []string{}
+		if util.InterfaceToStr(obj["title"]) != "" {
+			descriptionArr = append(descriptionArr, util.InterfaceToStr(obj["title"]))
+		}
+		area := util.InterfaceToStr(obj["area"])
+		city := util.InterfaceToStr(obj["city"])
+		if area != "" || city != "" {
+			descriptionArr = append(descriptionArr, fmt.Sprintf("项目所属地区是%s%s", area, city))
+		}
+		if util.InterfaceToStr(obj["buyer"]) != "" {
+			descriptionArr = append(descriptionArr, fmt.Sprintf("项目采购单位是%s", util.InterfaceToStr(obj["buyer"])))
+		}
+		if util.Int64All(obj["publishtime"]) != 0 {
+			descriptionArr = append(descriptionArr, fmt.Sprintf("项目发布时间是%s", pushTime.Format("2006年01月02日")))
+		}
+		description = strings.Join(descriptionArr, ",")
 	}
 	return description
 }