|
@@ -305,9 +305,7 @@ func GetArticleIdsBySubId(subjectId string) (articleIds string, err error) {
|
|
|
WHERE subject_ids LIKE '%` + subjectId + `%'`
|
|
|
err = o.Raw(sql).QueryRow(&articleIds)
|
|
|
return
|
|
|
-}
|
|
|
-
|
|
|
-//end
|
|
|
+} //end
|
|
|
|
|
|
//用户收藏榜start
|
|
|
type ArticleCollectionResp struct {
|
|
@@ -358,3 +356,198 @@ func GetArticleCollectionList(permissionName string) (items []*ArticleCollection
|
|
|
_, err = o.Raw(sql).QueryRows(&items)
|
|
|
return
|
|
|
} //end
|
|
|
+
|
|
|
+//用户收藏榜start
|
|
|
+type IndustrialManagementHotResp struct {
|
|
|
+ IndustrialManagementId int `orm:"column(industrial_management_id);pk" description:"产业id"`
|
|
|
+ IndustryName string `description:"产业名称"`
|
|
|
+ IsFollw bool `description:"是否关注"`
|
|
|
+ FllowNum int `description:"关注数量"`
|
|
|
+ IsNew bool `description:"是否新标签"`
|
|
|
+ IsHot bool `description:"是否新标签"`
|
|
|
+ PublishDate string `description:"发布时间"`
|
|
|
+ ArticleReadNum int `description:"文章阅读数量"`
|
|
|
+ IndustrialSubjectList []*IndustrialSubject `description:"标的列表"`
|
|
|
+}
|
|
|
+
|
|
|
+type IndustrialManagementHotListResp struct {
|
|
|
+ List []*IndustrialManagementHotResp
|
|
|
+}
|
|
|
+
|
|
|
+//产业列表
|
|
|
+func GetThemeHeatList(permissionName string, userId int, condition string) (items []*IndustrialManagementHotResp, err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ sql := `SELECT
|
|
|
+ m.industry_name,
|
|
|
+ m.industrial_management_id,
|
|
|
+ m.article_read_num,
|
|
|
+ date_format( MAX( a.publish_date ), '%Y-%m-%d' ) AS publish_date,
|
|
|
+ ( SELECT count( 1 ) FROM cygx_industry_fllow AS f WHERE f.industrial_management_id = m.industrial_management_id AND user_id =? ) AS fllow_num,
|
|
|
+ ( SELECT count( 1 ) FROM cygx_article_history_record_newpv AS h WHERE h.article_id IN (SELECT article_id FROM cygx_industrial_article_group_management WHERE industrial_management_id = m.industrial_management_id )) + ( SELECT count( 1 ) FROM cygx_activity_meet_detail_log AS la WHERE la.activity_id IN (SELECT activity_id FROM cygx_industrial_activity_group_management WHERE industrial_management_id = m.industrial_management_id )) AS sum_num
|
|
|
+ FROM
|
|
|
+ cygx_industrial_management AS m
|
|
|
+ LEFT JOIN cygx_industrial_article_group_management AS mg ON mg.industrial_management_id = m.industrial_management_id
|
|
|
+ LEFT JOIN cygx_article AS a ON a.article_id = mg.article_id
|
|
|
+ LEFT JOIN cygx_industrial_activity_group_management as ag ON ag.industrial_management_id = mg.industrial_management_id
|
|
|
+ WHERE
|
|
|
+ 1 = 1
|
|
|
+ AND a.is_report = 1
|
|
|
+ AND a.category_name LIKE '%` + permissionName + `%'
|
|
|
+ AND publish_status = 1
|
|
|
+ GROUP BY m.industrial_management_id ` + condition
|
|
|
+ _, err = o.Raw(sql, userId).QueryRows(&items)
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+//标的列表
|
|
|
+func GetThemeHeatSubjectList(permissionName string) (items []*IndustrialSubject, err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ sql := `SELECT
|
|
|
+ m.subject_name,
|
|
|
+ m.industrial_management_id,
|
|
|
+ m.industrial_subject_id
|
|
|
+ FROM
|
|
|
+ cygx_article AS a
|
|
|
+ INNER JOIN cygx_industrial_article_group_subject AS mg ON mg.article_id = a.article_id
|
|
|
+ INNER JOIN cygx_industrial_subject AS m ON m.industrial_subject_id = mg.industrial_subject_id
|
|
|
+ WHERE
|
|
|
+ 1 = 1
|
|
|
+ AND a.is_report = 1
|
|
|
+ AND a.category_name LIKE '%` + permissionName + `%'
|
|
|
+ AND publish_status = 1
|
|
|
+ GROUP BY
|
|
|
+ m.industrial_subject_id
|
|
|
+ ORDER BY
|
|
|
+ publish_date DESC`
|
|
|
+ _, err = o.Raw(sql).QueryRows(&items)
|
|
|
+ return
|
|
|
+} //end
|
|
|
+
|
|
|
+//Kol sratr
|
|
|
+type DepartmentResp struct {
|
|
|
+ DepartmentId int `description:"作者Id"`
|
|
|
+ NickName string `description:"作者昵称"`
|
|
|
+ ImgUrl string `description:"图片链接"`
|
|
|
+ IsFollw bool `description:"是否关注"`
|
|
|
+ FllowNum int `description:"关注数量"`
|
|
|
+ List []*IndustrialDepartmentListResp
|
|
|
+}
|
|
|
+
|
|
|
+type DepartmentListResp struct {
|
|
|
+ List []*DepartmentResp
|
|
|
+}
|
|
|
+type IndustrialDepartmentListResp struct {
|
|
|
+ IndustrialManagementId int `description:"产业Id"`
|
|
|
+ IndustryName string `description:"产业名称"`
|
|
|
+ DepartmentId int `description:"作者Id"`
|
|
|
+}
|
|
|
+
|
|
|
+//作者列表
|
|
|
+func GetDepartmentList(permissionName string, userId int) (items []*DepartmentResp, err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ sql := `SELECT
|
|
|
+ d.nick_name,
|
|
|
+ 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 =? ) AS fllow_num,
|
|
|
+ ( SELECT count( 1 ) FROM cygx_article_department_follow AS f WHERE f.department_id = d.department_id ) +( SELECT count( 1 ) FROM cygx_article_collect AS ac WHERE ac.article_id = a.article_id ) AS sum_num
|
|
|
+ FROM
|
|
|
+ cygx_article_department AS d
|
|
|
+ INNER JOIN cygx_article AS a ON d.department_id = a.department_id
|
|
|
+ WHERE
|
|
|
+ 1 = 1
|
|
|
+ AND a.is_report = 1
|
|
|
+ AND a.category_name LIKE '%` + permissionName + `%'
|
|
|
+ AND publish_status = 1
|
|
|
+ GROUP BY
|
|
|
+ d.department_id
|
|
|
+ ORDER BY
|
|
|
+ sum_num DESC
|
|
|
+ LIMIT 15`
|
|
|
+ _, err = o.Raw(sql, userId).QueryRows(&items)
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+//作者文章所关联的产业列表
|
|
|
+func GetIndustrialDepartmentList(permissionName string) (items []*IndustrialDepartmentListResp, err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ sql := `SELECT
|
|
|
+ m.industrial_management_id,
|
|
|
+ m.industry_name,
|
|
|
+ d.department_id
|
|
|
+ FROM
|
|
|
+ cygx_article_department AS d
|
|
|
+ INNER JOIN cygx_article AS a ON d.department_id = a.department_id
|
|
|
+ INNER JOIN cygx_industrial_article_group_management AS mg ON mg.article_id = a.article_id
|
|
|
+ INNER JOIN cygx_industrial_management AS m ON m.industrial_management_id = mg.industrial_management_id
|
|
|
+ WHERE
|
|
|
+ 1 = 1
|
|
|
+ AND a.is_report = 1
|
|
|
+ AND a.category_name LIKE '%` + permissionName + `%'
|
|
|
+ AND publish_status = 1
|
|
|
+ GROUP BY
|
|
|
+ a.article_id
|
|
|
+ ORDER BY
|
|
|
+ a.publish_date DESC`
|
|
|
+ _, err = o.Raw(sql).QueryRows(&items)
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+//主题详情start
|
|
|
+type GetThemeDetailListResp struct {
|
|
|
+ ArticleId int `description:"文章id"`
|
|
|
+ Title string `description:"标题"`
|
|
|
+ PublishDate string `description:"发布时间"`
|
|
|
+ SubjectName string `description:"标的名称"`
|
|
|
+ DepartmentId int `description:"作者Id"`
|
|
|
+ NickName string `description:"作者昵称"`
|
|
|
+ Pv int `description:"PV"`
|
|
|
+ CollectNum int `description:"收藏人数"`
|
|
|
+}
|
|
|
+
|
|
|
+//主题详情start
|
|
|
+type GetThemeDetailResp struct {
|
|
|
+ IndustrialManagementId int `description:"产业Id"`
|
|
|
+ IndustryName string `description:"产业名称"`
|
|
|
+ IsFollw bool `description:"是否关注"`
|
|
|
+ List []*GetThemeDetailListResp
|
|
|
+ ListSubject []*IndustrialSubject `description:"标的列表"`
|
|
|
+}
|
|
|
+
|
|
|
+//列表
|
|
|
+func GetThemeDetail(permissionName string) (items []*GetThemeDetailListResp, err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ sql := `SELECT
|
|
|
+ a.article_id,
|
|
|
+ a.title,
|
|
|
+ date_format( a.publish_date, '%Y-%m-%d' ) AS publish_date,
|
|
|
+ m.industry_name,
|
|
|
+ m.industrial_management_id,
|
|
|
+ d.nick_name,
|
|
|
+ d.department_id,
|
|
|
+ s.industrial_subject_id,
|
|
|
+ s.subject_name,
|
|
|
+ ( SELECT count( 1 ) FROM cygx_article_history_record_newpv AS h WHERE h.article_id = a.article_id ) AS pv,
|
|
|
+ ( SELECT count( 1 ) FROM cygx_article_collect AS ac WHERE ac.article_id = a.article_id ) AS collect_num
|
|
|
+ FROM
|
|
|
+ cygx_article AS a
|
|
|
+ INNER JOIN cygx_industrial_article_group_management AS mg ON mg.article_id = a.article_id
|
|
|
+ INNER JOIN cygx_industrial_management AS m ON m.industrial_management_id = mg.industrial_management_id
|
|
|
+ INNER JOIN cygx_article_department AS d ON d.department_id = a.department_id
|
|
|
+ LEFT JOIN cygx_industrial_article_group_subject as sg ON sg.article_id = a.article_id
|
|
|
+ LEFT JOIN cygx_industrial_subject as s ON s.industrial_subject_id = sg.industrial_subject_id
|
|
|
+ WHERE
|
|
|
+ 1 = 1
|
|
|
+ AND a.is_report = 1
|
|
|
+ AND a.category_name LIKE '%研选%'
|
|
|
+-- AND m.industrial_management_id = 337
|
|
|
+ AND publish_status = 1
|
|
|
+ GROUP BY
|
|
|
+ a.article_id
|
|
|
+ ORDER BY
|
|
|
+ publish_date DESC ,
|
|
|
+ s.industrial_subject_id DESC
|
|
|
+-- LIMIT 15`
|
|
|
+ _, err = o.Raw(sql).QueryRows(&items)
|
|
|
+ return
|
|
|
+}
|