Browse Source

产业搜索资源包添加来源字段

xingzai 2 years ago
parent
commit
5fd2ca1054
2 changed files with 7 additions and 2 deletions
  1. 4 1
      controllers/report.go
  2. 3 1
      models/report.go

+ 4 - 1
controllers/report.go

@@ -2251,6 +2251,7 @@ func (this *ReportController) SearchReport() {
 		return
 	}
 	for k, v := range listYx {
+		listYx[k].Source = 1
 		if v.MyCollectNum > 0 {
 			listYx[k].IsCollect = true
 		}
@@ -2262,6 +2263,7 @@ func (this *ReportController) SearchReport() {
 		return
 	}
 	for k, v := range listHz {
+		listHz[k].Source = 1
 		if v.MyCollectNum > 0 {
 			listHz[k].IsCollect = true
 		}
@@ -2331,7 +2333,7 @@ func (this *ReportController) SearchResource() {
 		return
 	}
 	for k, v := range listHz {
-
+		listHz[k].Source = 1
 		for _, v2 := range listSubjcet {
 			if v2.IndustrialManagementId == v.IndustrialManagementId {
 				listHz[k].IndustrialSubjectList = append(listHz[k].IndustrialSubjectList, v2)
@@ -2339,6 +2341,7 @@ func (this *ReportController) SearchResource() {
 		}
 	}
 	for k, v := range listYx {
+		listYx[k].Source = 2
 		for _, v2 := range listSubjcet {
 			if v2.IndustrialManagementId == v.IndustrialManagementId {
 				listYx[k].IndustrialSubjectList = append(listYx[k].IndustrialSubjectList, v2)

+ 3 - 1
models/report.go

@@ -322,6 +322,7 @@ type ArticleCollectionResp struct {
 	CollectNum             int    `description:"收藏人数"`
 	MyCollectNum           int    `description:"本人是否收藏"`
 	IsCollect              bool   `description:"本人是否收藏"`
+	Source                 int    `description:"来源 1:弘则资源包(报告)、2:研选主题(报告)"`
 }
 
 type ArticleCollectionLIstResp struct {
@@ -366,6 +367,7 @@ type IndustrialManagementHotResp struct {
 	IsHot                  bool                 `description:"是否新标签"`
 	PublishDate            string               `description:"发布时间"`
 	ArticleReadNum         int                  `description:"文章阅读数量"`
+	Source                 int                  `description:"来源 1:弘则资源包(报告)、2:研选主题(报告)"`
 	IndustrialSubjectList  []*IndustrialSubject `description:"标的列表"`
 }
 
@@ -449,7 +451,7 @@ func GetDepartmentList(permissionName string, userId int) (items []*DepartmentRe
 			d.department_id,
 			d.img_url,
 			( SELECT count( 1 ) FROM cygx_article_department_follow AS f  WHERE f.department_id = d.department_id  AND user_id =?  AND f.type= 1  ) AS fllow_num,
-			( SELECT count( 1 ) FROM cygx_article_department_follow  AS f INNER JOIN wx_user AS u ON u.user_id = f.user_id  WHERE f.department_id = d.department_id AND f.type= 1 ) +( SELECT count( 1 ) FROM cygx_article_collect AS ac INNER JOIN wx_user AS u ON u.user_id = ac.user_id  WHERE ac.article_id = a.article_id) AS sum_num
+			( SELECT count( 1 ) FROM cygx_article_department_follow  AS f INNER JOIN wx_user AS u ON u.user_id = f.user_id  WHERE f.department_id = d.department_id AND f.type= 1 ) +( SELECT count( 1 ) FROM cygx_article_collect AS ac INNER JOIN wx_user AS u ON u.user_id = ac.user_id  WHERE ac.article_id IN (SELECT article_id FROM cygx_article WHERE department_id = d.department_id )) AS sum_num
 		FROM
 		cygx_article_department AS d
 			INNER JOIN cygx_article AS a ON d.department_id = a.department_id