|
@@ -5,7 +5,6 @@ import (
|
|
|
"github.com/rdlucklib/rdluck_tools/paging"
|
|
|
"strconv"
|
|
|
"time"
|
|
|
-
|
|
|
//"github.com/rdlucklib/rdluck_tools/paging"
|
|
|
)
|
|
|
|
|
@@ -64,7 +63,7 @@ type IndustrialSubject struct {
|
|
|
LayoutTime string `description:"产业布局时间"`
|
|
|
}
|
|
|
|
|
|
-//获取产业报告数量
|
|
|
+// 获取产业报告数量
|
|
|
func GetReportIndustrialCount(categoryId, industrialManagementId int) (count int, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT COUNT(1) count
|
|
@@ -86,7 +85,7 @@ WHERE
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-//获取产业报告列表
|
|
|
+// 获取产业报告列表
|
|
|
func GetReportIndustrialList(pars []interface{}, categoryId, industrialManagementId, userId, startSize, pageSize int) (items []*ReportArticle, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT *,( SELECT COUNT( 1 ) FROM cygx_article_history_record AS rec WHERE rec.user_id = ` + strconv.Itoa(userId) + ` AND rec.article_id = a.article_id ) AS readnum
|
|
@@ -109,7 +108,7 @@ WHERE
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-//产业下所关联的文章分类列表
|
|
|
+// 产业下所关联的文章分类列表
|
|
|
func IndustrialToArticleCategory(industrialManagementId, chartPermissionId int) (items []*IndustrialToArticleCategoryRep, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT map.match_type_name,map.category_id
|
|
@@ -127,7 +126,7 @@ func IndustrialToArticleCategory(industrialManagementId, chartPermissionId int)
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-//产业下所关联的文章分类列表 2022-10-13
|
|
|
+// 产业下所关联的文章分类列表 2022-10-13
|
|
|
func IndustrialToArticleCategoryNew(industrialManagementId int) (items []*IndustrialToArticleCategoryRep, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT map.match_type_name,map.category_id
|
|
@@ -144,7 +143,7 @@ func IndustrialToArticleCategoryNew(industrialManagementId int) (items []*Indust
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-//判断用户是否阅读该产业下,某一分类的文章
|
|
|
+// 判断用户是否阅读该产业下,某一分类的文章
|
|
|
func IndustrialUserRecordArticleCount(userId, industrialManagementId, categoryId int) (count int, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT
|
|
@@ -164,7 +163,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 match_type_name = any( SELECT match_type_name FROM cygx_report_mapping WHERE category_id = ? ) ORDER BY publish_date DESC LIMIT 0, 1`
|
|
@@ -179,7 +178,7 @@ WHERE
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-//获取最新文章
|
|
|
+// 获取最新文章
|
|
|
func GetNewArticleByCategoryId(categoryId int) (item *ArticleDetail, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := ` SELECT * FROM cygx_article WHERE category_id = ? ORDER BY publish_date DESC LIMIT 0, 1`
|
|
@@ -216,7 +215,7 @@ type ReportArticleWhichIndustrialRepList struct {
|
|
|
List []*ReportArticleWhichIndustrial
|
|
|
}
|
|
|
|
|
|
-//列表
|
|
|
+// 列表
|
|
|
func IndustrialToArticleWhichDepartment(condition string, pars []interface{}, uid, startSize, pageSize int) (items []*ReportArticleWhichIndustrial, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT
|
|
@@ -275,7 +274,7 @@ type SearchTxt struct {
|
|
|
TabSearch string `description:"素材库搜索说明"`
|
|
|
}
|
|
|
|
|
|
-//获取用户是否有查看权限
|
|
|
+// 获取用户是否有查看权限
|
|
|
func GetUserIsAdminCount(mobile string) (count int, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT COUNT(1) count FROM admin
|
|
@@ -331,7 +330,7 @@ type CygxIndustrySearchListPc struct {
|
|
|
IndList []*IndustrialManagement `description:"产业列表"`
|
|
|
}
|
|
|
|
|
|
-//列表
|
|
|
+// 列表
|
|
|
func GetCygxIndustryAndArticleList(keyWord string) (items []*CygxIndustryAndArticleList, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT
|
|
@@ -362,7 +361,7 @@ func GetArticleIdsBySubId(subjectId string) (articleIds string, err error) {
|
|
|
return
|
|
|
} //end
|
|
|
|
|
|
-//用户收藏榜start
|
|
|
+// 用户收藏榜start
|
|
|
type ArticleCollectionResp struct {
|
|
|
ArticleId int `description:"文章id"`
|
|
|
Title string `description:"标题"`
|
|
@@ -376,6 +375,7 @@ type ArticleCollectionResp struct {
|
|
|
Pv int `description:"PV"`
|
|
|
CollectNum int `description:"收藏人数"`
|
|
|
Source int `description:"来源 1:弘则资源包(报告)、2:研选主题(报告)"`
|
|
|
+ ArticleTypeId int `description:"文章类型ID"`
|
|
|
List []*IndustrialManagementResp `description:"产业列表"`
|
|
|
}
|
|
|
|
|
@@ -389,7 +389,7 @@ type ArticleCollectionLIstResp struct {
|
|
|
List []*ArticleCollectionResp
|
|
|
}
|
|
|
|
|
|
-//列表
|
|
|
+// 列表
|
|
|
func GetArticleCollectionList(condition string, userId int) (items []*ArticleCollectionResp, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT
|
|
@@ -418,7 +418,67 @@ func GetArticleCollectionList(condition string, userId int) (items []*ArticleCol
|
|
|
return
|
|
|
} //end
|
|
|
|
|
|
-//用户收藏榜start
|
|
|
+type ArticleResearchListResp struct {
|
|
|
+ Paging *paging.PagingItem
|
|
|
+ List []*ArticleResearchResp
|
|
|
+}
|
|
|
+
|
|
|
+type ArticleResearchResp 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:研选主题(报告)"`
|
|
|
+ ArticleTypeId int `description:"文章类型ID"`
|
|
|
+ ArticleTypeName string `description:"类型名称"`
|
|
|
+ ButtonStyle string `description:"按钮展示样式"`
|
|
|
+ List []*IndustrialManagementResp `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 []*ArticleCollectionResp, err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ sql := `SELECT
|
|
|
+ a.article_id,
|
|
|
+ a.title,
|
|
|
+ date_format( a.publish_date, '%Y-%m-%d' ) AS 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
|
|
|
+}
|
|
|
+
|
|
|
+// 用户收藏榜start
|
|
|
type IndustrialManagementHotResp struct {
|
|
|
IndustrialManagementId int `orm:"column(industrial_management_id);pk" description:"产业id"`
|
|
|
IndustryName string `description:"产业名称"`
|
|
@@ -442,7 +502,7 @@ type IndustrialManagementHotListResp struct {
|
|
|
List []*IndustrialManagementHotResp
|
|
|
}
|
|
|
|
|
|
-//产业列表
|
|
|
+// 产业列表
|
|
|
func GetThemeHeatList(userId int, condition string, startSize, pageSize int) (items []*IndustrialManagementHotResp, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT
|
|
@@ -467,7 +527,7 @@ func GetThemeHeatList(userId int, condition string, startSize, pageSize int) (it
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-//获取数量
|
|
|
+// 获取数量
|
|
|
func GetThemeHeatListCount(condition string) (count int, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT COUNT( DISTINCT m.industrial_management_id ) FROM
|
|
@@ -482,7 +542,7 @@ func GetThemeHeatListCount(condition string) (count int, err error) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-//标的列表
|
|
|
+// 标的列表
|
|
|
func GetThemeHeatSubjectList(condition string) (items []*IndustrialSubject, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT
|
|
@@ -507,7 +567,7 @@ func GetThemeHeatSubjectList(condition string) (items []*IndustrialSubject, err
|
|
|
return
|
|
|
} //end
|
|
|
|
|
|
-//Kol sratr
|
|
|
+// Kol sratr
|
|
|
type DepartmentResp struct {
|
|
|
DepartmentId int `description:"作者Id"`
|
|
|
NickName string `description:"作者昵称"`
|
|
@@ -526,7 +586,7 @@ type IndustrialDepartmentListResp struct {
|
|
|
DepartmentId int `description:"作者Id"`
|
|
|
}
|
|
|
|
|
|
-//作者列表
|
|
|
+// 作者列表
|
|
|
func GetDepartmentList(userId int) (items []*DepartmentResp, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT
|
|
@@ -551,7 +611,7 @@ func GetDepartmentList(userId int) (items []*DepartmentResp, err error) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-//作者文章所关联的产业列表
|
|
|
+// 作者文章所关联的产业列表
|
|
|
func GetIndustrialDepartmentList() (items []*IndustrialDepartmentListResp, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT
|
|
@@ -575,7 +635,7 @@ func GetIndustrialDepartmentList() (items []*IndustrialDepartmentListResp, err e
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-//主题详情start
|
|
|
+// 主题详情start
|
|
|
type GetThemeDetailListResp struct {
|
|
|
ArticleId int `description:"文章id"`
|
|
|
Title string `description:"标题"`
|
|
@@ -613,7 +673,7 @@ type GetThemeAericleListBuSubjectResp struct {
|
|
|
List []*GetThemeAericleListResp
|
|
|
}
|
|
|
|
|
|
-//主题详情start
|
|
|
+// 主题详情start
|
|
|
type GetThemeDetailResp struct {
|
|
|
IndustrialManagementId int `description:"产业Id"`
|
|
|
IndustryName string `description:"产业名称"`
|
|
@@ -622,7 +682,7 @@ type GetThemeDetailResp struct {
|
|
|
List []*GetThemeAericleListResp
|
|
|
}
|
|
|
|
|
|
-//列表
|
|
|
+// 列表
|
|
|
func GetThemeDetail(userId, industrialManagementId int, condition string) (items []*GetThemeDetailListResp, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT
|
|
@@ -656,7 +716,7 @@ func GetThemeDetail(userId, industrialManagementId int, condition string) (items
|
|
|
return
|
|
|
} //end
|
|
|
|
|
|
-//用户收藏榜start
|
|
|
+// 用户收藏榜start
|
|
|
type DepartmentDetailResp struct {
|
|
|
DepartmentId int `description:"作者Id"`
|
|
|
NickName string `description:"作者昵称"`
|
|
@@ -680,7 +740,7 @@ type DepartmentDetail struct {
|
|
|
MyFllowNum int `description:"本人是否关注"`
|
|
|
}
|
|
|
|
|
|
-//列表
|
|
|
+// 列表
|
|
|
func GetDepartmentDetail(userId, departmentId int) (item DepartmentDetail, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT
|
|
@@ -699,13 +759,13 @@ func GetDepartmentDetail(userId, departmentId int) (item DepartmentDetail, err e
|
|
|
return
|
|
|
} //end
|
|
|
|
|
|
-//报告搜索start
|
|
|
+// 报告搜索start
|
|
|
type ReoprtSearchResp struct {
|
|
|
ListYx []*ArticleCollectionResp `description:"研选报告"`
|
|
|
ListHz []*ArticleCollectionResp `description:"弘则报告"`
|
|
|
}
|
|
|
|
|
|
-//列表
|
|
|
+// 列表
|
|
|
func GetReoprtSearchList(condition string, userId int) (items []*ArticleCollectionResp, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT
|
|
@@ -730,13 +790,13 @@ func GetReoprtSearchList(condition string, userId int) (items []*ArticleCollecti
|
|
|
return
|
|
|
} //end
|
|
|
|
|
|
-//搜索资源包 start
|
|
|
+// 搜索资源包 start
|
|
|
type SearchResourceResp struct {
|
|
|
ListHz []*IndustrialManagementHotResp `description:"弘则"`
|
|
|
ListYx []*IndustrialManagementHotResp `description:"研选"`
|
|
|
}
|
|
|
|
|
|
-//搜索资源包 start
|
|
|
+// 搜索资源包 start
|
|
|
type SearchReportAndResourceResp struct {
|
|
|
ListHzResource []*IndustrialManagementHotResp `description:"弘则资源包"`
|
|
|
ListYxResource []*IndustrialManagementHotResp `description:"研选资源包"`
|
|
@@ -744,7 +804,7 @@ type SearchReportAndResourceResp struct {
|
|
|
ListHzReport []*ArticleCollectionResp `description:"弘则报告"`
|
|
|
}
|
|
|
|
|
|
-//产业列表
|
|
|
+// 产业列表
|
|
|
func GetSearchResourceList(userId int, condition string, startSize, pageSize int) (items []*IndustrialManagementHotResp, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT
|
|
@@ -769,19 +829,19 @@ func GetSearchResourceList(userId int, condition string, startSize, pageSize int
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-//切换列表
|
|
|
+// 切换列表
|
|
|
type ReportBillboardTableResp struct {
|
|
|
Name string `description:"名称"`
|
|
|
Source int `description:"类型"`
|
|
|
List []*ChartPermission
|
|
|
}
|
|
|
|
|
|
-//切换列表
|
|
|
+// 切换列表
|
|
|
type ReportBillboardTableListResp struct {
|
|
|
List []*ReportBillboardTableResp
|
|
|
}
|
|
|
|
|
|
-//报告榜单start
|
|
|
+// 报告榜单start
|
|
|
type ArticleReportBillboardResp struct {
|
|
|
ArticleId int `description:"文章id"`
|
|
|
Title string `description:"标题"`
|
|
@@ -805,7 +865,7 @@ type ArticleReportBillboardLIstPageResp struct {
|
|
|
Paging *paging.PagingItem
|
|
|
}
|
|
|
|
|
|
-//报告收藏榜单列表
|
|
|
+// 报告收藏榜单列表
|
|
|
func GetReportCollectionBillboardList(limit int, pars []interface{}, condition string) (items []*ArticleReportBillboardResp, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT
|
|
@@ -831,7 +891,7 @@ func GetReportCollectionBillboardList(limit int, pars []interface{}, condition s
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-//报告阅读榜单列表
|
|
|
+// 报告阅读榜单列表
|
|
|
func GetReportPvBillboardList(pars []interface{}, condition string) (items []*ArticleReportBillboardResp, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT
|
|
@@ -851,7 +911,7 @@ func GetReportPvBillboardList(pars []interface{}, condition string) (items []*Ar
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-//获取产业报告+晨会点评数量
|
|
|
+// 获取产业报告+晨会点评数量
|
|
|
func GetTimeLineReportIndustrialCount(industrialManagementId int) (count int, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT SUM(count) AS count FROM (
|
|
@@ -891,7 +951,7 @@ type TimeLineReportItem struct {
|
|
|
Readnum int `description:"阅读数量"`
|
|
|
}
|
|
|
|
|
|
-//获取产业报告+晨会点评列表
|
|
|
+// 获取产业报告+晨会点评列表
|
|
|
func GetTimeLineReportIndustrialList(userId, industrialManagementId, startSize, pageSize int) (items []*TimeLineReportItem, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT
|
|
@@ -947,7 +1007,7 @@ type IndustrialReadNum struct {
|
|
|
Readnum int `description:"阅读次数"`
|
|
|
}
|
|
|
|
|
|
-//获取该产业下文章的用户阅读次数-小红点用
|
|
|
+// 获取该产业下文章的用户阅读次数-小红点用
|
|
|
func GetReportIndustrialReadNumList(userId int, industrialIds string, createtime time.Time) (items []*IndustrialReadNum, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT a.industrial_management_id, MIN(a.readnum) AS readnum FROM (
|