|
@@ -448,54 +448,20 @@ func GetResourceDataEsList(list []*SearchComprehensiveItem, user *models.WxUserI
|
|
|
mapItems[fmt.Sprint(v.Source, v.SourceId)] = item
|
|
|
}
|
|
|
|
|
|
- var articleIds []int
|
|
|
- var newchartIds []int
|
|
|
- var roadshowIds []string
|
|
|
- var activityIds []int
|
|
|
- var activityvideoIds []string
|
|
|
- var activityvoiceIds []string
|
|
|
- var activityspecialIds []int
|
|
|
- var researchsummaryIds []int
|
|
|
- var minutessummaryIds []int
|
|
|
- var meetingreviewchaptIds []int
|
|
|
- var productinteriorIds []int
|
|
|
- var industrialResourceIdsHz []int // 弘则产业资源包
|
|
|
- var industrialResourceIdsYx []int // 研选产业资源包
|
|
|
+ var articleIds []int //报告
|
|
|
+ var activityIds []int //活动
|
|
|
var yanxuanSpecialIds []int // 研选专栏
|
|
|
- var askserieVideoIds []string //问答系列视频
|
|
|
+ var yanxuanspecialauthorIds []int //研选作者ID
|
|
|
//Source string `description:"资源类型 报告 :article 、图表 :newchart、微路演 :roadshow、活动 :activity、活动视频:activityvideo、活动音频:activityvoice、专项调研活动:activityspecial 、 本周研究汇总: researchsummary 、 上周纪要汇总 :minutessummary 、晨会精华 :meetingreviewchapt "`
|
|
|
for _, v := range list {
|
|
|
if v.Source == "article" {
|
|
|
articleIds = append(articleIds, v.SourceId)
|
|
|
- } else if v.Source == "newchart" {
|
|
|
- newchartIds = append(newchartIds, v.SourceId)
|
|
|
- } else if v.Source == "roadshow" {
|
|
|
- roadshowIds = append(roadshowIds, strconv.Itoa(v.SourceId))
|
|
|
} else if v.Source == "activity" {
|
|
|
activityIds = append(activityIds, v.SourceId)
|
|
|
- } else if v.Source == "activityvideo" {
|
|
|
- activityvideoIds = append(activityvideoIds, strconv.Itoa(v.SourceId))
|
|
|
- } else if v.Source == "activityvoice" {
|
|
|
- activityvoiceIds = append(activityvoiceIds, strconv.Itoa(v.SourceId))
|
|
|
- } else if v.Source == "activityspecial" {
|
|
|
- activityspecialIds = append(activityspecialIds, v.SourceId)
|
|
|
- } else if v.Source == "researchsummary" {
|
|
|
- researchsummaryIds = append(researchsummaryIds, v.SourceId)
|
|
|
- } else if v.Source == "minutessummary" {
|
|
|
- minutessummaryIds = append(minutessummaryIds, v.SourceId)
|
|
|
- } else if v.Source == "meetingreviewchapt" {
|
|
|
- meetingreviewchaptIds = append(meetingreviewchaptIds, v.SourceId)
|
|
|
- } else if v.Source == "productinterior" {
|
|
|
- productinteriorIds = append(productinteriorIds, v.SourceId)
|
|
|
- } else if v.Source == "industrialsourceHz" {
|
|
|
- industrialResourceIdsHz = append(industrialResourceIdsHz, v.SourceId)
|
|
|
- } else if v.Source == "industrialsourceYx" {
|
|
|
- industrialResourceIdsYx = append(industrialResourceIdsYx, v.SourceId)
|
|
|
} else if v.Source == utils.CYGX_OBJ_YANXUANSPECIAL {
|
|
|
yanxuanSpecialIds = append(yanxuanSpecialIds, v.SourceId)
|
|
|
- yanXuanbodyHighlight[v.SourceId] = v.Body
|
|
|
- } else if v.Source == utils.CYGX_OBJ_ASKSERIEVIDEO {
|
|
|
- askserieVideoIds = append(askserieVideoIds, strconv.Itoa(v.SourceId))
|
|
|
+ } else if v.Source == utils.CYGX_OBJ_YANXUANSPECIAL_AUTHOR {
|
|
|
+ yanxuanspecialauthorIds = append(yanxuanspecialauthorIds, v.SourceId)
|
|
|
}
|
|
|
}
|
|
|
//处理文章
|
|
@@ -628,6 +594,25 @@ func GetResourceDataEsList(list []*SearchComprehensiveItem, user *models.WxUserI
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ //处理研选专栏作者
|
|
|
+ lenyanxuanspecialauthorIds := len(yanxuanspecialauthorIds)
|
|
|
+ if lenyanxuanspecialauthorIds > 0 {
|
|
|
+ pars = make([]interface{}, 0)
|
|
|
+ condition = ` AND a.id IN (` + utils.GetOrmInReplace(lenyanxuanspecialauthorIds) + `) `
|
|
|
+ condition += ` ORDER BY latest_publish_time DESC `
|
|
|
+ pars = append(pars, yanxuanspecialauthorIds)
|
|
|
+ listAuthor, e := models.GetYanxuanSpecialAuthorList(condition, pars, 0, lenyanxuanspecialauthorIds)
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New("GetYanxuanSpecialAuthorList, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for _, v := range listAuthor {
|
|
|
+ v.LatestPublishDate = v.LatestPublishTime.Format(utils.FormatDate)
|
|
|
+ v.LabelKeywordImgLink = utils.LABEL_ICO_9
|
|
|
+ mapItems[fmt.Sprint(utils.CYGX_OBJ_YANXUANSPECIAL_AUTHOR, v.Id)].YanxuanSpecialAuthor = v
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
for _, vList := range list {
|
|
|
for _, v := range mapItems {
|
|
|
//如果这些类型都为空,那么就不合并
|
|
@@ -678,9 +663,17 @@ func SqlComprehensiveSearch(user *models.WxUserItem, keyWord string, startSize,
|
|
|
var parsTitle []interface{}
|
|
|
conditionTitle = " AND search_title LIKE ? " + condition
|
|
|
parsTitle = append(parsTitle, keyWord)
|
|
|
- totalTitle, e := models.GetResourceDataCount(conditionTitle, parsTitle)
|
|
|
+
|
|
|
+ var conditionContentYxAuthor string // 研选专栏作者搜索条件
|
|
|
+ var parsContentYxAuthor []interface{}
|
|
|
+
|
|
|
+ conditionContentYxAuthor = " AND (special_name LIKE ? OR nick_name LIKE ? ) "
|
|
|
+ parsContentYxAuthor = append(parsContentYxAuthor, keyWord, keyWord)
|
|
|
+ totalTitle, e := models.GetResourceDataAndYanxuanSpecialAuthorCount(conditionTitle, parsTitle, conditionContentYxAuthor, parsContentYxAuthor)
|
|
|
+
|
|
|
+ //totalTitle, e := models.GetResourceDataCount(conditionTitle, parsTitle)
|
|
|
if e != nil {
|
|
|
- err = errors.New("GetResourceDataCount, Err: " + e.Error())
|
|
|
+ err = errors.New("GetResourceDataAndYanxuanSpecialAuthorCount, Err: " + e.Error())
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -703,9 +696,10 @@ func SqlComprehensiveSearch(user *models.WxUserItem, keyWord string, startSize,
|
|
|
if totalTitle >= searchTotal {
|
|
|
fmt.Println("1")
|
|
|
//全部都是标题搜索
|
|
|
- list, e = models.GetResourceDataListCondition(conditionTitle, parsTitle, startSize, pageSize)
|
|
|
+ //list, e = models.GetResourceDataListCondition(conditionTitle, parsTitle, startSize, pageSize)
|
|
|
+ list, e = models.GetResourceDataAndYanxuanSpecialAuthorListCondition(conditionTitle, parsTitle, conditionContentYxAuthor, parsContentYxAuthor, startSize, pageSize)
|
|
|
if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
- err = errors.New("GetResourceDataListCondition, Err: " + e.Error())
|
|
|
+ err = errors.New("GetResourceDataAndYanxuanSpecialAuthorListCondition, Err: " + e.Error())
|
|
|
return
|
|
|
}
|
|
|
} else if totalTitle <= searchTotal-pageSize {
|
|
@@ -722,9 +716,10 @@ func SqlComprehensiveSearch(user *models.WxUserItem, keyWord string, startSize,
|
|
|
fmt.Println("3")
|
|
|
//一半标题搜索,一半内容搜索
|
|
|
|
|
|
- list, e = models.GetResourceDataListCondition(conditionTitle, parsTitle, startSize, pageSize)
|
|
|
+ //list, e = models.GetResourceDataListCondition(conditionTitle, parsTitle, startSize, pageSize)
|
|
|
+ list, e = models.GetResourceDataAndYanxuanSpecialAuthorListCondition(conditionTitle, parsTitle, conditionContentYxAuthor, parsContentYxAuthor, startSize, pageSize)
|
|
|
if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
- err = errors.New("GetResourceDataListCondition, Err: " + e.Error())
|
|
|
+ err = errors.New("GetResourceDataAndYanxuanSpecialAuthorListCondition, Err: " + e.Error())
|
|
|
return
|
|
|
}
|
|
|
listContent, e := models.GetResourceDataListCondition(conditionContent, parsContent, 0, pageSize-totalContent%pageSize)
|