wangchuanjin 1 жил өмнө
parent
commit
637cfacd40

+ 6 - 7
recommend/recommend.go

@@ -20,10 +20,14 @@ type Recommend struct {
 }
 
 func (r *Recommend) SubRecommend(clickhouse *Mysql, domain, userId, content string, mailPush int) (string, string, string, int) {
-	datas := clickhouse.SelectBySql(`select bitmapToArray(infoids) as infoids from jianyu.sub_recommend_list where userid=? order by update_time desc limit 1`, userId)
+	datas := clickhouse.SelectBySql(`select bitmapToArray(infoids) as infoids,area from jianyu.sub_recommend_list where userid=? order by update_time desc limit 1`, userId)
 	if datas == nil || len(*datas) == 0 {
 		return "", "", "", 0
 	}
+	area, _ := (*datas)[0]["area"].(string)
+	if area == "" {
+		area = "全国"
+	}
 	infoids, _ := (*datas)[0]["infoids"].([]uint64)
 	if len(infoids) == 0 {
 		return "", "", "", 0
@@ -38,17 +42,12 @@ func (r *Recommend) SubRecommend(clickhouse *Mysql, domain, userId, content stri
 	}
 	mailContent := ""
 	firstTitle := ""
-	firstArea := ""
 	infosLength := 0
 	for _, v := range *list {
 		infosLength++
 		info := NewBiddingInfo(v, []string{})
 		if infosLength == 1 {
 			firstTitle = info.ClearTitle
-			firstArea = info.Area
-			if firstArea == "" {
-				firstArea = "全国"
-			}
 		}
 		if mailPush == 1 { //关于邮件的处理
 			url := fmt.Sprintf("%s/article/mailprivate/%s.html", domain, encrypt.CommonEncodeArticle("mailprivate", info.Id))
@@ -71,5 +70,5 @@ func (r *Recommend) SubRecommend(clickhouse *Mysql, domain, userId, content stri
 			mailContent += fmt.Sprintf(content, infosLength, url, info.HighlightTitle, areaClassName, info.Area, typeClassName, info.Infotype, industryClassName, info.Buyerclass, acountClassName, info.Acount, info.PublishtimeDiff)
 		}
 	}
-	return firstTitle, firstArea, mailContent, infosLength
+	return firstTitle, area, mailContent, infosLength
 }