|
@@ -51,13 +51,13 @@ type TacticsListResp struct {
|
|
|
List []*HomeArticle
|
|
|
}
|
|
|
|
|
|
-//报告搜索start
|
|
|
+// 报告搜索start
|
|
|
type ReoprtSearchResp struct {
|
|
|
Paging *paging.PagingItem
|
|
|
ListHz []*ArticleCollectionResp `description:"弘则报告"`
|
|
|
}
|
|
|
|
|
|
-//搜索资源包 start
|
|
|
+// 搜索资源包 start
|
|
|
type SearchResourceResp struct {
|
|
|
ListHz []*IndustrialManagement `description:"弘则"`
|
|
|
}
|
|
@@ -76,7 +76,7 @@ type SearchResourceResp struct {
|
|
|
// IndustrialSubjectList []*IndustrialSubject `description:"标的列表"`
|
|
|
//}
|
|
|
|
|
|
-//获取列表数量
|
|
|
+// 获取列表数量
|
|
|
func GetReoprtSearchCount(condition string) (count int, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT
|
|
@@ -93,7 +93,7 @@ func GetReoprtSearchCount(condition string) (count int, err error) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-//列表
|
|
|
+// 列表
|
|
|
func GetReoprtSearchList(condition string, userId, startSize, pageSize int) (items []*ArticleCollectionResp, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT
|
|
@@ -124,7 +124,7 @@ func GetReoprtSearchList(condition string, userId, startSize, pageSize int) (ite
|
|
|
return
|
|
|
} //end
|
|
|
|
|
|
-//列表
|
|
|
+// 列表
|
|
|
func GetSearchResourceList(condition string) (items []*IndustrialManagement, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT
|
|
@@ -145,7 +145,7 @@ func GetSearchResourceList(condition string) (items []*IndustrialManagement, err
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-//标的列表
|
|
|
+// 标的列表
|
|
|
func GetThemeHeatSubjectList(condition string) (items []*IndustrialSubject, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT
|
|
@@ -170,7 +170,7 @@ func GetThemeHeatSubjectList(condition string) (items []*IndustrialSubject, err
|
|
|
return
|
|
|
} //end
|
|
|
|
|
|
-//产业下所关联的文章分类列表
|
|
|
+// 产业下所关联的文章分类列表
|
|
|
func IndustrialToArticleCategory(industrialManagementId, chartPermissionId int) (items []*IndustrialToArticleCategoryRep, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT map.match_type_name,map.category_id
|
|
@@ -188,7 +188,7 @@ func IndustrialToArticleCategory(industrialManagementId, chartPermissionId int)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-//判断用户是否阅读该产业下,某一分类的文章
|
|
|
+// 判断用户是否阅读该产业下,某一分类的文章
|
|
|
func IndustrialUserRecordArticleCount(userId, industrialManagementId, categoryId int) (count int, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT
|
|
@@ -202,7 +202,7 @@ WHERE
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-//获取最新文章
|
|
|
+// 获取最新文章
|
|
|
func GetNewIndustrialUserRecordArticle(industrialManagementId, categoryId int) (item *ArticleDetail, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := ` SELECT * FROM cygx_article WHERE article_id IN (SELECT article_id FROM cygx_industrial_article_group_management WHERE industrial_management_id = ? ) AND category_id = ? ORDER BY publish_date DESC LIMIT 0, 1`
|
|
@@ -210,7 +210,7 @@ func GetNewIndustrialUserRecordArticle(industrialManagementId, categoryId int) (
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-//列表
|
|
|
+// 列表
|
|
|
func GetReoprtSearchListHz(condition string, userId int) (items []*ArticleCollectionResp, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT
|
|
@@ -236,7 +236,7 @@ func GetReoprtSearchListHz(condition string, userId int) (items []*ArticleCollec
|
|
|
return
|
|
|
} //end
|
|
|
|
|
|
-//产业列表
|
|
|
+// 产业列表
|
|
|
func GetSearchResourceListHz(condition string, startSize, pageSize int) (items []*IndustrialManagementHotResp, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT
|
|
@@ -259,7 +259,7 @@ func GetSearchResourceListHz(condition string, startSize, pageSize int) (items [
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-//用户收藏榜start
|
|
|
+// 用户收藏榜start
|
|
|
type IndustrialManagementHotResp struct {
|
|
|
IndustrialManagementId int `orm:"column(industrial_management_id);pk" description:"产业id"`
|
|
|
IndustryName string `description:"产业名称"`
|
|
@@ -270,17 +270,18 @@ type IndustrialManagementHotResp struct {
|
|
|
PublishDate string `description:"发布时间"`
|
|
|
ArticleReadNum int `description:"文章阅读数量"`
|
|
|
Source int `description:"来源 1:弘则资源包(报告)、2:研选主题(报告)"`
|
|
|
+ MinReportTime string `description:"报告最早发布时间"`
|
|
|
IndustrialSubjectList []*IndustrialSubject `description:"标的列表"`
|
|
|
}
|
|
|
|
|
|
-//搜索资源包 start
|
|
|
+// 搜索资源包 start
|
|
|
type SearchReportAndResourceResp struct {
|
|
|
ListHzResource []*IndustrialManagement `description:"弘则资源包"`
|
|
|
ListHzReport []*ArticleCollectionResp `description:"弘则报告"`
|
|
|
Paging *paging.PagingItem `description:"弘则报告分页"`
|
|
|
}
|
|
|
|
|
|
-//报告收藏榜单列表
|
|
|
+// 报告收藏榜单列表
|
|
|
func GetReportCollectionBillboardList(limit int, pars []interface{}, condition string) (items []*ArticleListResp, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT
|
|
@@ -308,7 +309,7 @@ func GetReportCollectionBillboardList(limit int, pars []interface{}, condition s
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-//研选报告收藏榜单列表
|
|
|
+// 研选报告收藏榜单列表
|
|
|
func GetReportCollectionBillboardListYx(limit int, pars []interface{}, condition string) (items []*ArticleListResp, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT
|
|
@@ -335,7 +336,7 @@ func GetReportCollectionBillboardListYx(limit int, pars []interface{}, condition
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-//获取产业报告+晨会点评列表
|
|
|
+// 获取产业报告+晨会点评列表
|
|
|
func GetTimeLineReportIndustrialList(industrialManagementId, startSize, pageSize int) (items []*HomeArticle, total int, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT
|
|
@@ -374,7 +375,7 @@ type IndustrialPublishdate struct {
|
|
|
IndustrialManagementId int `description:"产业D"`
|
|
|
}
|
|
|
|
|
|
-//标的列表
|
|
|
+// 标的列表
|
|
|
func GetTimeLineReportIndustrialPublishdateList(industrialIdArr []int) (items []*IndustrialPublishdate, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT
|
|
@@ -395,7 +396,7 @@ func GetTimeLineReportIndustrialPublishdateList(industrialIdArr []int) (items []
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-//报告榜单start
|
|
|
+// 报告榜单start
|
|
|
type ArticleReportBillboardResp struct {
|
|
|
ArticleId int `description:"文章id"`
|
|
|
Title string `description:"标题"`
|
|
@@ -413,4 +414,194 @@ type ArticleReportBillboardResp struct {
|
|
|
type ArticleReportBillboardLIstPageResp struct {
|
|
|
List []*ArticleReportBillboardResp
|
|
|
Paging *paging.PagingItem
|
|
|
-}
|
|
|
+}
|
|
|
+
|
|
|
+type ArticleResearchListResp struct {
|
|
|
+ Paging *paging.PagingItem
|
|
|
+ List []*ArticleResearchResp
|
|
|
+}
|
|
|
+
|
|
|
+type ArticleResearchResp struct {
|
|
|
+ ArticleId int `description:"文章id"`
|
|
|
+ Title string `description:"标题"`
|
|
|
+ Annotation string `description:"核心观点"`
|
|
|
+ Abstract 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:研选主题(报告)"`
|
|
|
+ ArticleTypeId int `description:"文章类型ID"`
|
|
|
+ ArticleTypeName string `description:"类型名称"`
|
|
|
+ ButtonStyle string `description:"按钮展示样式"`
|
|
|
+ ImgUrlPc string `description:"图片链接"`
|
|
|
+ List []*IndustrialManagementIdInt `description:"产业列表"`
|
|
|
+ ListSubject []*IndustrialSubject `description:"标的列表"`
|
|
|
+}
|
|
|
+
|
|
|
+// 获取数量
|
|
|
+func GetArticleResearchCount(condition string, pars []interface{}) (count int, err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ sqlCount := `SELECT COUNT( 1 ) AS count FROM
|
|
|
+ cygx_article AS a
|
|
|
+ WHERE
|
|
|
+ 1 = 1 AND a.publish_status = 1` + condition
|
|
|
+ err = o.Raw(sqlCount, pars).QueryRow(&count)
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+func GetArticleResearchList(condition string, pars []interface{}, startSize, pageSize, userId int) (items []*ArticleListResp, err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ sql := `SELECT
|
|
|
+ a.article_id,
|
|
|
+ a.title,
|
|
|
+ a.body,
|
|
|
+ a.annotation,
|
|
|
+ a.abstract,
|
|
|
+ a.publish_date,
|
|
|
+ a.article_type_id,
|
|
|
+ d.nick_name,
|
|
|
+ d.department_id,
|
|
|
+ ( 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 INNER JOIN wx_user as u ON u.user_id = ac.user_id WHERE ac.article_id = a.article_id ) AS collect_num,
|
|
|
+ ( 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 AND DATE_SUB( CURDATE(), INTERVAL 30 DAY ) <= date( ac.create_time ) ) AS collect_num_order,
|
|
|
+ ( SELECT count( 1 ) FROM cygx_article_collect AS ac WHERE ac.article_id = a.article_id AND user_id = ? ) AS my_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
|
|
|
+ WHERE
|
|
|
+ 1 = 1 AND a.publish_status = 1 `
|
|
|
+ if condition != "" {
|
|
|
+ sql += condition
|
|
|
+ }
|
|
|
+ sql += ` GROUP BY a.article_id ORDER BY a.publish_date DESC LIMIT ?,? `
|
|
|
+ _, err = o.Raw(sql, userId, pars, startSize, pageSize).QueryRows(&items)
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+type IndustrialManagementHotListResp struct {
|
|
|
+ Paging *paging.PagingItem `description:"分页数据"`
|
|
|
+ List []*IndustrialManagementHotResp
|
|
|
+}
|
|
|
+
|
|
|
+// 获取数量
|
|
|
+func GetThemeHeatListCount(condition string) (count int, err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ sql := `SELECT COUNT( DISTINCT m.industrial_management_id ) 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.article_type_id > 0 AND a.publish_status = 1 ` + condition
|
|
|
+ err = o.Raw(sql).QueryRow(&count)
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+// 产业列表
|
|
|
+func GetThemeHeatList(userId int, condition string, startSize, pageSize int) (items []*IndustrialManagementHotResp, err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ sql := `SELECT
|
|
|
+ m.industry_name,
|
|
|
+ m.industrial_management_id,
|
|
|
+ m.article_read_num,
|
|
|
+ MAX( a.publish_date ) AS publish_date,
|
|
|
+ MIN(a.publish_date) AS min_report_time,
|
|
|
+ ( SELECT count( 1 ) FROM cygx_industry_fllow AS f WHERE f.industrial_management_id = m.industrial_management_id AND user_id =? AND f.type = 1 ) AS fllow_num,
|
|
|
+ m.article_read_num + ( 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 ) AND DATE_SUB( CURDATE(), INTERVAL 30 DAY ) <= date( la.activity_time ) ) 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.article_type_id > 0
|
|
|
+ AND publish_status = 1
|
|
|
+ GROUP BY m.industrial_management_id ` + condition + ` LIMIT ?,?`
|
|
|
+ _, err = o.Raw(sql, userId, startSize, pageSize).QueryRows(&items)
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+type GetThemeAericleListResp struct {
|
|
|
+ ArticleId int `description:"文章id"`
|
|
|
+ Title string `description:"标题"`
|
|
|
+ PublishDate string `description:"发布时间"`
|
|
|
+ SubjectName string `description:"标的名称"`
|
|
|
+ IndustrialSubjectId int `description:"标的ID"`
|
|
|
+ DepartmentId int `description:"作者Id"`
|
|
|
+ NickName string `description:"作者昵称"`
|
|
|
+ Pv int `description:"PV"`
|
|
|
+ CollectNum int `description:"收藏人数"`
|
|
|
+ FllowNum int `description:"关注数量"`
|
|
|
+ MyCollectNum int `description:"本人是否收藏"`
|
|
|
+ IsCollect bool `description:"本人是否收藏"`
|
|
|
+}
|
|
|
+
|
|
|
+// 主题详情start
|
|
|
+type GetThemeDetailResp struct {
|
|
|
+ IndustrialManagementId int `description:"产业Id"`
|
|
|
+ IndustryName string `description:"产业名称"`
|
|
|
+ IsFollw bool `description:"是否关注"`
|
|
|
+ ListSubject []*IndustrialSubject `description:"标的列表"`
|
|
|
+ List []*ArticleResearchResp
|
|
|
+}
|
|
|
+
|
|
|
+// 主题详情start
|
|
|
+type GetThemeDetailListResp struct {
|
|
|
+ ArticleId int `description:"文章id"`
|
|
|
+ Title string `description:"标题"`
|
|
|
+ PublishDate string `description:"发布时间"`
|
|
|
+ SubjectName string `description:"标的名称"`
|
|
|
+ IndustrialSubjectId int `description:"标的id"`
|
|
|
+ DepartmentId int `description:"作者Id"`
|
|
|
+ NickName string `description:"作者昵称"`
|
|
|
+ Pv int `description:"PV"`
|
|
|
+ CollectNum int `description:"收藏人数"`
|
|
|
+ IndustrialManagementId int `description:"产业Id"`
|
|
|
+ IndustryName string `description:"产业名称"`
|
|
|
+ FllowNum int `description:"关注数量"`
|
|
|
+ MyCollectNum int `description:"本人是否收藏"`
|
|
|
+ IsCollect bool `description:"本人是否收藏"`
|
|
|
+}
|
|
|
+
|
|
|
+type GetThemeAericleListBuSubjectResp struct {
|
|
|
+ SubjectName string `description:"标的名称"`
|
|
|
+ List []*GetThemeAericleListResp
|
|
|
+}
|
|
|
+
|
|
|
+// 列表
|
|
|
+func GetThemeDetail(userId, industrialManagementId int, condition string) (items []*ArticleListResp, err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ sql := `SELECT
|
|
|
+ a.article_id,
|
|
|
+ a.title,
|
|
|
+ a.body,
|
|
|
+ a.annotation,
|
|
|
+ a.abstract,
|
|
|
+ a.publish_date,
|
|
|
+ a.article_type_id,
|
|
|
+ d.nick_name,
|
|
|
+ d.department_id,
|
|
|
+ ( 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,
|
|
|
+ ( SELECT count( 1 ) FROM cygx_article_collect AS ac WHERE ac.article_id = a.article_id and user_id = ? ) AS my_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
|
|
|
+ WHERE
|
|
|
+ 1 = 1
|
|
|
+ AND m.industrial_management_id = ?
|
|
|
+ AND publish_status = 1 ` + condition + `
|
|
|
+ ORDER BY
|
|
|
+ publish_date DESC`
|
|
|
+ _, err = o.Raw(sql, userId, industrialManagementId).QueryRows(&items)
|
|
|
+ return
|
|
|
+} //end
|