|
@@ -19,14 +19,14 @@ var VarRecommend = &Recommend{}
|
|
|
type Recommend struct {
|
|
|
}
|
|
|
|
|
|
-func (r *Recommend) SubRecommend(clickhouse *Mysql, domain, userId, content string, mailPush int) (string, string, int) {
|
|
|
+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)
|
|
|
if datas == nil || len(*datas) == 0 {
|
|
|
- return "", "", 0
|
|
|
+ return "", "", "", 0
|
|
|
}
|
|
|
infoids, _ := (*datas)[0]["infoids"].([]uint64)
|
|
|
if len(infoids) == 0 {
|
|
|
- return "", "", 0
|
|
|
+ return "", "", "", 0
|
|
|
}
|
|
|
ids := []string{}
|
|
|
for _, v := range infoids {
|
|
@@ -34,16 +34,21 @@ func (r *Recommend) SubRecommend(clickhouse *Mysql, domain, userId, content stri
|
|
|
}
|
|
|
list := elastic.Get(Es_Bidding, Es_Bidding, fmt.Sprintf(query, strings.Join(ids, ",")))
|
|
|
if list == nil || len(*list) == 0 {
|
|
|
- return "", "", 0
|
|
|
+ return "", "", "", 0
|
|
|
}
|
|
|
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))
|
|
@@ -66,5 +71,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, mailContent, infosLength
|
|
|
+ return firstTitle, firstArea, mailContent, infosLength
|
|
|
}
|