|
@@ -12,6 +12,7 @@ type IndustrialManagementRep struct {
|
|
|
ChartPermissionId int `description:"权限id"`
|
|
|
RecommendedIndex int `description:"推荐指数"`
|
|
|
LayoutTime string `description:"布局时间"`
|
|
|
+ ArticleReadNum int `description:"文章阅读数量"`
|
|
|
}
|
|
|
|
|
|
type IndustrialManagementCount struct {
|
|
@@ -71,9 +72,6 @@ func GetIndustrialManagementAll(uid int, condition, orderSrt string, startSize,
|
|
|
GROUP BY
|
|
|
man.industry_name
|
|
|
ORDER BY ` + orderSrt + ` LIMIT ?,?`
|
|
|
- //fmt.Println(sql)
|
|
|
- //fmt.Println(startSize)
|
|
|
- //fmt.Println(pageSize)
|
|
|
_, err = o.Raw(sql, startSize, pageSize).QueryRows(&items)
|
|
|
return
|
|
|
}
|
|
@@ -230,3 +228,36 @@ func UpdateIndustrialManagementSubjectNames(nameStr string, industrialManagement
|
|
|
_, err = o.Raw(sql, nameStr, industrialManagementId).Exec()
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+// 处理每个产业下所关联的文章的阅读量 start
|
|
|
+func IndustrialManagementAll() (items []*IndustrialManagement, err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ sql := `SELECT * FROM cygx_industrial_management `
|
|
|
+ _, err = o.Raw(sql).QueryRows(&items)
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+func GetIndustrialManagementArtCount(industrialManagementId int) (count int, err error) {
|
|
|
+ sqlCount := ` SELECT COUNT(1) AS count
|
|
|
+ FROM cygx_article_history_record AS h
|
|
|
+ INNER JOIN cygx_industrial_article_group_management as mg ON mg.article_id = h.article_id
|
|
|
+ WHERE mg.industrial_management_id = ?`
|
|
|
+ o := orm.NewOrm()
|
|
|
+ err = o.Raw(sqlCount, industrialManagementId).QueryRow(&count)
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+func UpdateIndustrialManagementArtReadNum(num, industrialManagementId int) (err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ sql := `UPDATE cygx_industrial_management SET article_read_num = ? WHERE industrial_management_id = ?`
|
|
|
+ _, err = o.Raw(sql, num, industrialManagementId).Exec()
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+//获取产业下阅读数量第三的产业详情
|
|
|
+func GetIndustrialManagementHot3() (item *IndustrialManagementRep, err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ sql := `SELECT * FROM cygx_industrial_management ORDER BY article_read_num DESC LIMIT 2,1`
|
|
|
+ err = o.Raw(sql).QueryRow(&item)
|
|
|
+ return
|
|
|
+}
|