Browse Source

报告搜素字段补充

xingzai 2 years ago
parent
commit
f11c13136f
3 changed files with 54 additions and 11 deletions
  1. 29 1
      controllers/report.go
  2. 20 10
      models/article.go
  3. 5 0
      models/report.go

+ 29 - 1
controllers/report.go

@@ -727,6 +727,7 @@ func (this *MobileReportController) SearchReport() {
 	}
 	startSize = paging.StartIndex(currentIndex, pageSize)
 	page := paging.GetPaging(currentIndex, pageSize, total)
+	resp := new(models.ReoprtSearchResp)
 	//匹配报告标题、
 	condition = ` AND ( a.title LIKE '%` + keyWord + `%' OR  a.body LIKE '%` + keyWord + `%') AND a.publish_status = 1 `
 
@@ -778,13 +779,40 @@ func (this *MobileReportController) SearchReport() {
 			industrialMap[v.ArticleId] = append(industrialMap[v.ArticleId], item)
 		}
 	}
+
+	detailCategoryUrl, err := models.GetConfigByCode("category_map_img_url")
+	if err != nil {
+		br.Msg = "获取数据失败"
+		br.ErrMsg = "行业配置信息失败,Err:" + err.Error()
+		return
+	}
+	categoryUrlList := strings.Split(detailCategoryUrl.ConfigValue, "{|}")
+	mapCategoryUrl := make(map[string]string)
+	var categoryId string
+	var imgUrlChart string
+	for _, v := range categoryUrlList {
+		vslice := strings.Split(v, "_")
+		categoryId = vslice[0]
+		imgUrlChart = vslice[len(vslice)-1]
+		mapCategoryUrl[categoryId] = imgUrlChart
+	}
+
 	for k, v := range listHz {
 		if len(industrialMap[v.ArticleId]) > 0 {
 			listHz[k].List = industrialMap[v.ArticleId]
 		} else {
 			listHz[k].List = make([]*models.IndustrialManagementResp, 0)
 		}
+		listHz[k].Body = ""
+		listHz[k].Abstract, _ = services.GetReportContentTextSub(v.Abstract)
+		listHz[k].Annotation, _ = services.GetReportContentTextSub(v.Annotation)
+		//行业比较研究、资金流向,显示报告的摘要
+		if listHz[k].CategoryName == "行业比较研究" || listHz[k].CategoryName == "资金流向" {
+			listHz[k].Annotation = listHz[k].Abstract
+		}
+		listHz[k].ImgUrlPc = mapCategoryUrl[v.CategoryId]
 	}
+
 	if keyWord != "" {
 		go services.AddUserSearchLog(user, keyWord, 5)
 	}
@@ -793,7 +821,7 @@ func (this *MobileReportController) SearchReport() {
 	}
 
 	page = paging.GetPaging(currentIndex, pageSize, total)
-	resp := new(models.ReoprtSearchResp)
+
 	resp.Paging = page
 	resp.ListHz = listHz
 	br.Ret = 200

+ 20 - 10
models/article.go

@@ -98,16 +98,26 @@ func GetArticleCountById(articleId int) (count int, err error) {
 
 //用户收藏榜start
 type ArticleCollectionResp struct {
-	ArticleId    int                         `description:"文章id"`
-	Title        string                      `description:"标题"`
-	PublishDate  string                      `description:"发布时间"`
-	DepartmentId int                         `description:"作者Id"`
-	NickName     string                      `description:"作者昵称"`
-	IsCollect    bool                        `description:"本人是否收藏"`
-	Pv           int                         `description:"PV"`
-	CollectNum   int                         `description:"收藏人数"`
-	Source       int                         `description:"来源 1:弘则资源包(报告)、2:研选主题(报告)"`
-	List         []*IndustrialManagementResp `description:"产业列表"`
+	ArticleId       int                         `description:"文章id"`
+	Title           string                      `description:"标题"`
+	PublishDate     string                      `description:"发布时间"`
+	DepartmentId    int                         `description:"作者Id"`
+	NickName        string                      `description:"作者昵称"`
+	IsCollect       bool                        `description:"本人是否收藏"`
+	Pv              int                         `description:"PV"`
+	CollectNum      int                         `description:"收藏人数"`
+	Source          int                         `description:"来源 1:弘则资源包(报告)、2:研选主题(报告)"`
+	List            []*IndustrialManagementResp `description:"产业列表"`
+	Body            string                      `description:"内容"`
+	Abstract        string                      `description:"摘要"`
+	Annotation      string                      `description:"核心观点"`
+	CategoryName    string                      `description:"一级分类"`
+	SubCategoryName string                      `description:"二级分类"`
+	IsResearch      bool                        `description:"是否属于研选"`
+	ImgUrlPc        string                      `description:"图片链接"`
+	CategoryId      string                      `description:"文章分类"`
+	HttpUrl         string                      `description:"文章链接跳转地址"`
+	IsNeedJump      bool                        `description:"是否需要跳转链接地址"`
 }
 
 //列表

+ 5 - 0
models/report.go

@@ -80,6 +80,11 @@ func GetReoprtSearchList(condition string, userId, startSize, pageSize int) (ite
 	sql := `SELECT
 			a.article_id,
 			a.title,
+			a.body,
+			a.abstract,
+			a.annotation,
+			a.category_id,
+			a.category_name,
 			date_format( a.publish_date, '%Y-%m-%d' ) AS publish_date,
 			m.industry_name,
 			m.industrial_management_id,