|
@@ -380,59 +380,85 @@ func GetArticleUserCollectCount(userId int) (count int, err error) {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+//art.article_id,
|
|
|
+//art.article_type_id,
|
|
|
+//art.title,
|
|
|
+//art.publish_date,
|
|
|
+//'' AS company_tags,
|
|
|
+//'' AS industry_tags,
|
|
|
+//art.department_id,
|
|
|
+//d.nick_name,
|
|
|
+//0 AS is_special,
|
|
|
+//0 as pv,
|
|
|
+//0 as collect_num,
|
|
|
+//a.create_time
|
|
|
+//FROM
|
|
|
+//cygx_article AS art
|
|
|
+//INNER JOIN cygx_article_history_record_newpv AS a ON art.article_id = a.article_id
|
|
|
+//INNER JOIN cygx_article_department AS d ON d.department_id = art.department_id
|
|
|
+//WHERE
|
|
|
+//a.user_id = ?
|
|
|
+//AND a.create_time >= ?
|
|
|
+//AND art.article_type_id > 0
|
|
|
+//GROUP BY
|
|
|
+//art.article_id UNION ALL
|
|
|
+//SELECT
|
|
|
+//art.id AS article_id,
|
|
|
+//- 1 AS article_type_id,
|
|
|
+//art.title,
|
|
|
+//art.publish_time AS publish_date,
|
|
|
+//art.company_tags AS company_tags,
|
|
|
+//art.industry_tags AS industry_tags,
|
|
|
+//d.id AS department_id,
|
|
|
+//d.nick_name,
|
|
|
+//1 AS is_special,
|
|
|
+//art.pv,
|
|
|
+//art.article_collect_num as collect_num,
|
|
|
+//a.create_time
|
|
|
+
|
|
|
func GetArticleUserCollectList(startSize, pageSize, userId int) (items []*ArticleListResp, err error) {
|
|
|
sql := `SELECT
|
|
|
- a.article_id,
|
|
|
- art.category_id,
|
|
|
- art.title,
|
|
|
- '' AS publish_date,
|
|
|
- '' AS nick_name,
|
|
|
- 0 AS article_type_id,
|
|
|
- '' AS article_type_name,
|
|
|
- 0 AS is_special_int,
|
|
|
- '' AS special_tags,
|
|
|
- 0 AS pv,
|
|
|
- 0 AS collect_num,
|
|
|
- 0 AS my_collect_num,
|
|
|
- 0 AS special_type,
|
|
|
- a.user_id AS user_id,
|
|
|
- '' AS company_tag_str,
|
|
|
- '' AS industry_tag_str,
|
|
|
- 0 AS special_column_id,
|
|
|
- a.create_time AS create_time
|
|
|
- FROM cygx_article_collect AS a
|
|
|
- INNER JOIN cygx_article as art ON art.article_id = a.article_id
|
|
|
+ art.article_id,
|
|
|
+ art.article_type_id,
|
|
|
+ art.title,
|
|
|
+ art.publish_date,
|
|
|
+ '' AS company_tags,
|
|
|
+ '' AS industry_tags,
|
|
|
+ art.department_id,
|
|
|
+ d.nick_name,
|
|
|
+ 0 AS is_special,
|
|
|
+ 0 as pv,
|
|
|
+ 0 as collect_num,
|
|
|
+ a.create_time
|
|
|
+ FROM
|
|
|
+ cygx_article AS art
|
|
|
+ INNER JOIN cygx_article_collect as a ON art.article_id = a.article_id
|
|
|
+ INNER JOIN cygx_article_department AS d ON d.department_id = art.department_id
|
|
|
WHERE a.user_id=?
|
|
|
AND art.article_type_id > 0
|
|
|
UNION ALL
|
|
|
SELECT
|
|
|
- a.id AS article_id,
|
|
|
- 0 AS category_id,
|
|
|
- a.title AS title,
|
|
|
- date_format( a.publish_time, '%Y-%m-%d' ) AS publish_date,
|
|
|
- b.nick_name AS nick_name,
|
|
|
- -1 AS article_type_id,
|
|
|
- '' AS article_type_name,
|
|
|
- 1 AS is_special_int,
|
|
|
- a.tags AS special_tags,
|
|
|
- ( SELECT count( 1 ) FROM cygx_yanxuan_special_record AS h WHERE h.yanxuan_special_id = a.id ) AS pv,
|
|
|
- ( SELECT count( 1 ) FROM cygx_yanxuan_special_collect AS ac WHERE ac.yanxuan_special_id = a.id ) AS collect_num,
|
|
|
- ( SELECT count( 1 ) FROM cygx_yanxuan_special_collect AS ac WHERE ac.yanxuan_special_id = a.id AND user_id = ? ) AS my_collect_num,
|
|
|
- a.type AS special_type,
|
|
|
- a.user_id AS user_id,
|
|
|
- a.company_tags AS company_tag_str,
|
|
|
- a.industry_tags AS industry_tags_str,
|
|
|
- b.id AS special_column_id,
|
|
|
- c.create_time AS create_time
|
|
|
+ art.id AS article_id,
|
|
|
+ - 1 AS article_type_id,
|
|
|
+ art.title,
|
|
|
+ art.publish_time AS publish_date,
|
|
|
+ art.company_tags AS company_tags,
|
|
|
+ art.industry_tags AS industry_tags,
|
|
|
+ b.id AS department_id,
|
|
|
+ b.nick_name,
|
|
|
+ 1 AS is_special,
|
|
|
+ art.pv,
|
|
|
+ art.article_collect_num as collect_num,
|
|
|
+ c.create_time
|
|
|
FROM
|
|
|
- cygx_yanxuan_special AS a
|
|
|
- JOIN cygx_yanxuan_special_author AS b ON a.user_id = b.user_id
|
|
|
- JOIN cygx_yanxuan_special_collect AS c ON a.id = c.yanxuan_special_id
|
|
|
+ cygx_yanxuan_special AS art
|
|
|
+ JOIN cygx_yanxuan_special_author AS b ON art.user_id = b.user_id
|
|
|
+ JOIN cygx_yanxuan_special_collect AS c ON art.id = c.yanxuan_special_id
|
|
|
WHERE
|
|
|
- 1 = 1 AND a.status = 3 AND c.user_id=?
|
|
|
+ 1 = 1 AND art.status = 3 AND c.user_id=?
|
|
|
ORDER BY create_time DESC
|
|
|
LIMIT ?,? `
|
|
|
- _, err = orm.NewOrm().Raw(sql, userId, userId, userId, startSize, pageSize).QueryRows(&items)
|
|
|
+ _, err = orm.NewOrm().Raw(sql, userId, userId, startSize, pageSize).QueryRows(&items)
|
|
|
return
|
|
|
}
|
|
|
|