|
@@ -5,7 +5,6 @@ import (
|
|
|
"github.com/rdlucklib/rdluck_tools/paging"
|
|
|
"strconv"
|
|
|
"time"
|
|
|
-
|
|
|
//"github.com/rdlucklib/rdluck_tools/paging"
|
|
|
)
|
|
|
|
|
@@ -56,15 +55,7 @@ type IndustrialAnalyst struct {
|
|
|
IndustrialManagementId int `description:"产业id"`
|
|
|
}
|
|
|
|
|
|
-type IndustrialSubject struct {
|
|
|
- IndustrialSubjectId int `orm:"column(industrial_subject_id);pk" description:"标的id"`
|
|
|
- IndustrialManagementId int `description:"产业id"`
|
|
|
- SubjectName string `description:"标的名称"`
|
|
|
- IndustryName string `description:"产业名称"`
|
|
|
- LayoutTime string `description:"产业布局时间"`
|
|
|
-}
|
|
|
-
|
|
|
-//获取产业报告数量
|
|
|
+// 获取产业报告数量
|
|
|
func GetReportIndustrialCount(categoryId, industrialManagementId int) (count int, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT COUNT(1) count
|
|
@@ -86,7 +77,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 +100,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 +118,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 +135,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 +155,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 +170,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 +207,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 +266,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 +322,7 @@ type CygxIndustrySearchListPc struct {
|
|
|
IndList []*IndustrialManagement `description:"产业列表"`
|
|
|
}
|
|
|
|
|
|
-//列表
|
|
|
+// 列表
|
|
|
func GetCygxIndustryAndArticleList(keyWord string) (items []*CygxIndustryAndArticleList, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT
|
|
@@ -362,7 +353,7 @@ func GetArticleIdsBySubId(subjectId string) (articleIds string, err error) {
|
|
|
return
|
|
|
} //end
|
|
|
|
|
|
-//用户收藏榜start
|
|
|
+// 用户收藏榜start
|
|
|
type ArticleCollectionResp struct {
|
|
|
ArticleId int `description:"文章id"`
|
|
|
Title string `description:"标题"`
|
|
@@ -389,7 +380,7 @@ type ArticleCollectionLIstResp struct {
|
|
|
List []*ArticleCollectionResp
|
|
|
}
|
|
|
|
|
|
-//列表
|
|
|
+// 列表
|
|
|
func GetArticleCollectionList(condition string, userId int) (items []*ArticleCollectionResp, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT
|
|
@@ -418,7 +409,7 @@ func GetArticleCollectionList(condition string, userId int) (items []*ArticleCol
|
|
|
return
|
|
|
} //end
|
|
|
|
|
|
-//用户收藏榜start
|
|
|
+// 用户收藏榜start
|
|
|
type IndustrialManagementHotResp struct {
|
|
|
IndustrialManagementId int `orm:"column(industrial_management_id);pk" description:"产业id"`
|
|
|
IndustryName string `description:"产业名称"`
|
|
@@ -442,7 +433,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 +458,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 +473,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 +498,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 +517,7 @@ type IndustrialDepartmentListResp struct {
|
|
|
DepartmentId int `description:"作者Id"`
|
|
|
}
|
|
|
|
|
|
-//作者列表
|
|
|
+// 作者列表
|
|
|
func GetDepartmentList(userId int) (items []*DepartmentResp, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT
|
|
@@ -551,7 +542,7 @@ func GetDepartmentList(userId int) (items []*DepartmentResp, err error) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-//作者文章所关联的产业列表
|
|
|
+// 作者文章所关联的产业列表
|
|
|
func GetIndustrialDepartmentList() (items []*IndustrialDepartmentListResp, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT
|
|
@@ -575,7 +566,7 @@ func GetIndustrialDepartmentList() (items []*IndustrialDepartmentListResp, err e
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-//主题详情start
|
|
|
+// 主题详情start
|
|
|
type GetThemeDetailListResp struct {
|
|
|
ArticleId int `description:"文章id"`
|
|
|
Title string `description:"标题"`
|
|
@@ -613,7 +604,7 @@ type GetThemeAericleListBuSubjectResp struct {
|
|
|
List []*GetThemeAericleListResp
|
|
|
}
|
|
|
|
|
|
-//主题详情start
|
|
|
+// 主题详情start
|
|
|
type GetThemeDetailResp struct {
|
|
|
IndustrialManagementId int `description:"产业Id"`
|
|
|
IndustryName string `description:"产业名称"`
|
|
@@ -622,7 +613,7 @@ type GetThemeDetailResp struct {
|
|
|
List []*GetThemeAericleListResp
|
|
|
}
|
|
|
|
|
|
-//列表
|
|
|
+// 列表
|
|
|
func GetThemeDetail(userId, industrialManagementId int, condition string) (items []*GetThemeDetailListResp, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT
|
|
@@ -656,7 +647,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 +671,7 @@ type DepartmentDetail struct {
|
|
|
MyFllowNum int `description:"本人是否关注"`
|
|
|
}
|
|
|
|
|
|
-//列表
|
|
|
+// 列表
|
|
|
func GetDepartmentDetail(userId, departmentId int) (item DepartmentDetail, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT
|
|
@@ -699,13 +690,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 +721,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 +735,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 +760,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 +796,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 +822,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 +842,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 +882,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 +938,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 (
|