|
@@ -310,6 +310,7 @@ func GetResourceDataEsList(list []*SearchComprehensiveItem, user *models.WxUserI
|
|
|
var industrialResourceIdsYx []int // 研选产业资源包
|
|
|
var yanxuanSpecialIds []int // 研选专栏
|
|
|
var askserieVideoIds []string //问答系列视频
|
|
|
+ var reportselectionIds []int //报告精选
|
|
|
//Source string `description:"资源类型 报告 :article 、图表 :newchart、微路演 :roadshow、活动 :activity、活动视频:activityvideo、活动音频:activityvoice、专项调研活动:activityspecial 、 本周研究汇总: researchsummary 、 上周纪要汇总 :minutessummary 、晨会精华 :meetingreviewchapt 、 产品内测:productinterior
|
|
|
for _, v := range list {
|
|
|
if v.Source == "article" {
|
|
@@ -343,6 +344,8 @@ func GetResourceDataEsList(list []*SearchComprehensiveItem, user *models.WxUserI
|
|
|
yanXuanbodyHighlight[v.SourceId] = v.Body
|
|
|
} else if v.Source == utils.CYGX_OBJ_ASKSERIEVIDEO {
|
|
|
askserieVideoIds = append(askserieVideoIds, strconv.Itoa(v.SourceId))
|
|
|
+ } else if v.Source == "reportselection" {
|
|
|
+ reportselectionIds = append(reportselectionIds, v.SourceId)
|
|
|
}
|
|
|
}
|
|
|
detail, e := models.GetConfigByCode("city_img_url")
|
|
@@ -477,6 +480,26 @@ func GetResourceDataEsList(list []*SearchComprehensiveItem, user *models.WxUserI
|
|
|
mapItems[fmt.Sprint("productinterior", v.ProductInteriorId)].ProductInterior = v
|
|
|
}
|
|
|
}
|
|
|
+ //处理报告精选
|
|
|
+ lenreportselectionIds := len(reportselectionIds)
|
|
|
+ if lenreportselectionIds > 0 {
|
|
|
+ pars = make([]interface{}, 0)
|
|
|
+ condition = ` AND article_id IN (` + utils.GetOrmInReplace(lenreportselectionIds) + `)`
|
|
|
+ pars = append(pars, reportselectionIds)
|
|
|
+ listreportselection, e := models.GetReportSelectionList(condition, pars, 0, lenreportselectionIds)
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New("GetReportSelectionList, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ mapPv := GetCygxReportHistoryRecordListMap(reportselectionIds, "bgjx")
|
|
|
+ for _, v := range listreportselection {
|
|
|
+ v.Title += "(第" + v.Periods + "期)"
|
|
|
+ v.MarketStrategy = AnnotationHtml(v.MarketStrategy)
|
|
|
+ v.PublishDate = utils.TimeRemoveHms2(v.PublishDate)
|
|
|
+ v.Pv = mapPv[v.ArticleId]
|
|
|
+ mapItems[fmt.Sprint("reportselection", v.ArticleId)].ReportSelection = v
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
//处理活动
|
|
|
if len(activityIds) > 0 {
|
|
@@ -781,46 +804,46 @@ func GetResourceDataEsList(list []*SearchComprehensiveItem, user *models.WxUserI
|
|
|
for _, vList := range list {
|
|
|
for _, v := range mapItems {
|
|
|
//如果这些类型都为空,那么就不合并
|
|
|
- if v.Article == nil && v.Newchart == nil && v.Roadshow == nil && v.Activity == nil && v.Activityvideo == nil && v.Activityvoice == nil && v.Activityspecial == nil && v.Researchsummary == nil && v.Minutessummary == nil && v.Meetingreviewchapt == nil && v.ProductInterior == nil && v.IndustrialResource == nil && v.YanxuanSpecial == nil && v.AskserieVideo == nil {
|
|
|
+ if v.Article == nil && v.Newchart == nil && v.Roadshow == nil && v.Activity == nil && v.Activityvideo == nil && v.Activityvoice == nil && v.Activityspecial == nil && v.Researchsummary == nil && v.Minutessummary == nil && v.Meetingreviewchapt == nil && v.ProductInterior == nil && v.IndustrialResource == nil && v.YanxuanSpecial == nil && v.AskserieVideo == nil && v.ReportSelection == nil {
|
|
|
continue
|
|
|
}
|
|
|
- if v.Article != nil && v.SourceId == vList.SourceId {
|
|
|
- v.Article.Title = vList.Title
|
|
|
- }
|
|
|
- if v.Newchart != nil && v.SourceId == vList.SourceId {
|
|
|
- v.Newchart.Title = vList.Title
|
|
|
- }
|
|
|
- if v.Roadshow != nil && v.SourceId == vList.SourceId {
|
|
|
- v.Roadshow.Title = vList.Title
|
|
|
- }
|
|
|
- if v.Activity != nil && v.SourceId == vList.SourceId {
|
|
|
- v.Activity.ActivityName = vList.Title
|
|
|
- }
|
|
|
- if v.Activityvideo != nil && v.SourceId == vList.SourceId {
|
|
|
- v.Activityvideo.Title = vList.Title
|
|
|
- }
|
|
|
- if v.Activityvoice != nil && v.SourceId == vList.SourceId {
|
|
|
- v.Activityvoice.Title = vList.Title
|
|
|
- }
|
|
|
-
|
|
|
- if v.Activityspecial != nil && v.SourceId == vList.SourceId {
|
|
|
- v.Activityspecial.ResearchTheme = vList.Title
|
|
|
- }
|
|
|
- if v.Researchsummary != nil && v.SourceId == vList.SourceId {
|
|
|
- v.Researchsummary.Title = vList.Title
|
|
|
- }
|
|
|
- if v.Minutessummary != nil && v.SourceId == vList.SourceId {
|
|
|
- v.Minutessummary.Title = vList.Title
|
|
|
- }
|
|
|
- if v.ProductInterior != nil && v.SourceId == vList.SourceId {
|
|
|
- v.ProductInterior.Title = vList.Title
|
|
|
- }
|
|
|
- if v.IndustrialResource != nil && v.SourceId == vList.SourceId && v.Source == vList.Source {
|
|
|
- v.IndustrialResource.UpdateTime = strings.Replace(vList.PublishDate, "00:00:00", "", -1)
|
|
|
- }
|
|
|
- if v.YanxuanSpecial != nil && v.SourceId == vList.SourceId {
|
|
|
- v.YanxuanSpecial.Title = vList.Title
|
|
|
- }
|
|
|
+ //if v.Article != nil && v.SourceId == vList.SourceId {
|
|
|
+ // v.Article.Title = vList.Title
|
|
|
+ //}
|
|
|
+ //if v.Newchart != nil && v.SourceId == vList.SourceId {
|
|
|
+ // v.Newchart.Title = vList.Title
|
|
|
+ //}
|
|
|
+ //if v.Roadshow != nil && v.SourceId == vList.SourceId {
|
|
|
+ // v.Roadshow.Title = vList.Title
|
|
|
+ //}
|
|
|
+ //if v.Activity != nil && v.SourceId == vList.SourceId {
|
|
|
+ // v.Activity.ActivityName = vList.Title
|
|
|
+ //}
|
|
|
+ //if v.Activityvideo != nil && v.SourceId == vList.SourceId {
|
|
|
+ // v.Activityvideo.Title = vList.Title
|
|
|
+ //}
|
|
|
+ //if v.Activityvoice != nil && v.SourceId == vList.SourceId {
|
|
|
+ // v.Activityvoice.Title = vList.Title
|
|
|
+ //}
|
|
|
+ //
|
|
|
+ //if v.Activityspecial != nil && v.SourceId == vList.SourceId {
|
|
|
+ // v.Activityspecial.ResearchTheme = vList.Title
|
|
|
+ //}
|
|
|
+ //if v.Researchsummary != nil && v.SourceId == vList.SourceId {
|
|
|
+ // v.Researchsummary.Title = vList.Title
|
|
|
+ //}
|
|
|
+ //if v.Minutessummary != nil && v.SourceId == vList.SourceId {
|
|
|
+ // v.Minutessummary.Title = vList.Title
|
|
|
+ //}
|
|
|
+ //if v.ProductInterior != nil && v.SourceId == vList.SourceId {
|
|
|
+ // v.ProductInterior.Title = vList.Title
|
|
|
+ //}
|
|
|
+ //if v.IndustrialResource != nil && v.SourceId == vList.SourceId && v.Source == vList.Source {
|
|
|
+ // v.IndustrialResource.UpdateTime = strings.Replace(vList.PublishDate, "00:00:00", "", -1)
|
|
|
+ //}
|
|
|
+ //if v.YanxuanSpecial != nil && v.SourceId == vList.SourceId {
|
|
|
+ // v.YanxuanSpecial.Title = vList.Title
|
|
|
+ //}
|
|
|
if v.SourceId == vList.SourceId && v.Source == vList.Source {
|
|
|
items = append(items, v)
|
|
|
}
|
|
@@ -834,6 +857,72 @@ func GetResourceDataEsList(list []*SearchComprehensiveItem, user *models.WxUserI
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+func SqlComprehensiveSearch(keyWord string, startSize, pageSize int) (result []*SearchComprehensiveItem, total int, err error) {
|
|
|
+ keyWord = "%" + keyWord + "%"
|
|
|
+ var conditionTitle string
|
|
|
+ var parsTitle []interface{}
|
|
|
+ conditionTitle = " AND search_title LIKE ? "
|
|
|
+ parsTitle = append(parsTitle, keyWord)
|
|
|
+ totalTitle, e := models.GetResourceDataCount(conditionTitle, parsTitle)
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New("GetResourceDataCount, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ var conditionContent string
|
|
|
+ var parsContent []interface{}
|
|
|
+
|
|
|
+ conditionContent = " AND search_content LIKE ? AND search_title NOT LIKE ? "
|
|
|
+ parsContent = append(parsContent, keyWord, keyWord)
|
|
|
+ totalContent, e := models.GetResourceDataCount(conditionContent, parsContent)
|
|
|
+ if e != nil {
|
|
|
+ err = errors.New("AddCygxArticleViewRecord, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ var searchTotal int
|
|
|
+ searchTotal = (startSize/pageSize + 1) * pageSize
|
|
|
+ var list []*models.CygxResourceData
|
|
|
+ if totalTitle >= searchTotal {
|
|
|
+ //全部都是标题搜索
|
|
|
+ list, e = models.GetResourceDataListCondition(conditionTitle, parsTitle, startSize, pageSize)
|
|
|
+ if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
+ err = errors.New("GetResourceDataListCondition, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ } else if totalTitle <= searchTotal-pageSize {
|
|
|
+ //全部都是内容搜索
|
|
|
+ list, e = models.GetResourceDataListCondition(conditionContent, parsContent, startSize, pageSize)
|
|
|
+ if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
+ err = errors.New("GetResourceDataListCondition, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //一半标题搜索,一半内容搜索
|
|
|
+ list, e = models.GetResourceDataListCondition(conditionTitle, parsTitle, startSize, pageSize)
|
|
|
+ if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
+ err = errors.New("GetResourceDataListCondition, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ listContent, e := models.GetResourceDataListCondition(conditionContent, parsContent, 0, pageSize-totalContent%pageSize)
|
|
|
+ if e != nil && e.Error() != utils.ErrNoRow() {
|
|
|
+ err = errors.New("GetResourceDataListCondition, Err: " + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for _, v := range listContent {
|
|
|
+ list = append(list, v)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ for _, v := range list {
|
|
|
+ item := new(SearchComprehensiveItem)
|
|
|
+ item.SourceId = v.SourceId
|
|
|
+ item.Source = v.Source
|
|
|
+ result = append(result, item)
|
|
|
+ }
|
|
|
+ total = totalTitle + totalContent
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
// Es研选专栏
|
|
|
func EsAddYanxuanSpecial(sourceId int) {
|
|
|
var err error
|