|
@@ -34,19 +34,21 @@ type Recommend struct {
|
|
func (r *Recommend) SetNewest(size int) {
|
|
func (r *Recommend) SetNewest(size int) {
|
|
r.newest = elastic.Get(Es_Bidding, Es_Bidding, fmt.Sprintf(newestQuery, size))
|
|
r.newest = elastic.Get(Es_Bidding, Es_Bidding, fmt.Sprintf(newestQuery, size))
|
|
}
|
|
}
|
|
-func (r *Recommend) SubRecommend(tidb *Mysql, domain, userId, content string, mailPush, limit int) (string, string, string, string, int, int64) {
|
|
|
|
|
|
+func (r *Recommend) SubRecommend(tidb *Mysql, domain, userId, content string, mailPush, limit int) (string, string, string, string, int, int64, string, bool) {
|
|
list, area, jcly := r.getList(tidb, userId, limit)
|
|
list, area, jcly := r.getList(tidb, userId, limit)
|
|
if area == "" {
|
|
if area == "" {
|
|
area = "全国"
|
|
area = "全国"
|
|
}
|
|
}
|
|
|
|
+ var isNewestBid bool
|
|
if list == nil || len(*list) == 0 {
|
|
if list == nil || len(*list) == 0 {
|
|
list = r.newest
|
|
list = r.newest
|
|
jcly = newestTmpl
|
|
jcly = newestTmpl
|
|
|
|
+ isNewestBid = true
|
|
}
|
|
}
|
|
if list == nil || len(*list) == 0 {
|
|
if list == nil || len(*list) == 0 {
|
|
- return "", "", "", "", 0, 0
|
|
|
|
|
|
+ return "", "", "", "", 0, 0, "", false
|
|
}
|
|
}
|
|
- var firstTitle, mailContent string
|
|
|
|
|
|
+ var firstTitle, mailContent, firstId string
|
|
infosLength := 0
|
|
infosLength := 0
|
|
var firstAutoId int64
|
|
var firstAutoId int64
|
|
for _, v := range *list {
|
|
for _, v := range *list {
|
|
@@ -55,6 +57,7 @@ func (r *Recommend) SubRecommend(tidb *Mysql, domain, userId, content string, ma
|
|
if infosLength == 1 {
|
|
if infosLength == 1 {
|
|
firstTitle = info.ClearTitle
|
|
firstTitle = info.ClearTitle
|
|
firstAutoId = info.AutoId
|
|
firstAutoId = info.AutoId
|
|
|
|
+ firstId = info.Id
|
|
}
|
|
}
|
|
if mailPush == 1 { //关于邮件的处理
|
|
if mailPush == 1 { //关于邮件的处理
|
|
url := fmt.Sprintf("%s/article/mailprivate/%s.html", domain, encrypt.CommonEncodeArticle("mailprivate", info.Id))
|
|
url := fmt.Sprintf("%s/article/mailprivate/%s.html", domain, encrypt.CommonEncodeArticle("mailprivate", info.Id))
|
|
@@ -77,7 +80,7 @@ func (r *Recommend) SubRecommend(tidb *Mysql, domain, userId, content string, ma
|
|
mailContent += fmt.Sprintf(content, infosLength, url, info.HighlightTitle, areaClassName, info.Area, typeClassName, info.Infotype, industryClassName, info.Buyerclass, acountClassName, info.Acount, info.PublishtimeDiff)
|
|
mailContent += fmt.Sprintf(content, infosLength, url, info.HighlightTitle, areaClassName, info.Area, typeClassName, info.Infotype, industryClassName, info.Buyerclass, acountClassName, info.Acount, info.PublishtimeDiff)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- return firstTitle, area, jcly, mailContent, infosLength, firstAutoId
|
|
|
|
|
|
+ return firstTitle, area, jcly, mailContent, infosLength, firstAutoId, firstId, isNewestBid
|
|
}
|
|
}
|
|
|
|
|
|
//
|
|
//
|