|
@@ -154,10 +154,47 @@ func GetArticleUserCollectCount(userId int) (count int, err error) {
|
|
|
}
|
|
|
|
|
|
func GetArticleUserCollectList(startSize, pageSize, userId int) (items []*ArticleReportBillboardResp, err error) {
|
|
|
- sql := `SELECT a.*,art.category_id FROM cygx_article_collect AS a INNER JOIN cygx_article as art ON art.article_id = a.article_id
|
|
|
+ sql := `SELECT
|
|
|
+ a.article_id,
|
|
|
+ art.category_id,
|
|
|
+ '' AS title,
|
|
|
+ '' AS publish_date,
|
|
|
+ '' AS nick_name,
|
|
|
+ 0 AS article_type_id,
|
|
|
+ '' AS article_type_name,
|
|
|
+ 0 AS is_special,
|
|
|
+ '' AS special_tags,
|
|
|
+ 0 AS pv,
|
|
|
+ 0 AS collect_num,
|
|
|
+ 0 AS my_collect_num,
|
|
|
+ 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
|
|
|
WHERE a.user_id=?
|
|
|
- ORDER BY a.create_time DESC LIMIT ?,? `
|
|
|
- _, err = orm.NewOrm().Raw(sql, userId, startSize, pageSize).QueryRows(&items)
|
|
|
+ UNION ALL
|
|
|
+ SELECT
|
|
|
+ a.id AS article_id,
|
|
|
+ a.title AS title,
|
|
|
+ date_format( a.publish_time, '%Y-%m-%d' ) AS publish_date,
|
|
|
+ b.nick_name AS nick_name,
|
|
|
+ 0 AS category_id,
|
|
|
+ ( 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 INNER JOIN wx_user as u ON u.user_id = ac.user_id 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,
|
|
|
+ 1 AS is_special,
|
|
|
+ a.tags AS special_tags,
|
|
|
+ -1 AS article_type_id,
|
|
|
+ '' AS article_type_name,
|
|
|
+ c.create_time AS 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
|
|
|
+ WHERE
|
|
|
+ 1 = 1 AND a.status = 3 AND c.user_id=?
|
|
|
+ ORDER BY create_time DESC
|
|
|
+LIMIT ?,? `
|
|
|
+ _, err = orm.NewOrm().Raw(sql, userId, userId,userId, startSize, pageSize).QueryRows(&items)
|
|
|
return
|
|
|
}
|
|
|
|