|
@@ -69,15 +69,13 @@ func GetYanxuanSpecialAuthor(reqUserId, sysUserId int) (item *CygxYanxuanSpecial
|
|
|
o := orm.NewOrm()
|
|
|
sql := ``
|
|
|
sql = `SELECT
|
|
|
- a.*,c.company_name,
|
|
|
+ a.*,
|
|
|
( SELECT count( 1 ) FROM cygx_yanxuan_special_collect AS ac INNER JOIN cygx_yanxuan_special as cs ON ac.yanxuan_special_id = cs.id WHERE cs.user_id = a.user_id ) AS collect_num,
|
|
|
( SELECT count( 1 ) FROM cygx_yanxuan_special_follow AS cf WHERE cf.follow_user_id = a.user_id ) AS follow_num,
|
|
|
( SELECT count( 1 ) FROM cygx_yanxuan_special AS ca WHERE ca.user_id = a.user_id AND ca.status = 3 ) AS special_article_num,
|
|
|
( SELECT count( 1 ) FROM cygx_yanxuan_special_follow AS cf WHERE cf.follow_user_id =? AND cf.user_id = ? ) AS is_follow
|
|
|
FROM
|
|
|
- cygx_yanxuan_special_author as a
|
|
|
- LEFT JOIN wx_user AS u ON u.user_id = a.user_id
|
|
|
- LEFT JOIN company AS c ON c.company_id = u.company_id WHERE a.user_id=? `
|
|
|
+ cygx_yanxuan_special_author as a WHERE a.user_id=? `
|
|
|
err = o.Raw(sql, reqUserId, sysUserId, reqUserId).QueryRow(&item)
|
|
|
return
|
|
|
}
|
|
@@ -94,7 +92,6 @@ func GetYanxuanSpecialAuthorBySpecialColumnId(specialColumnId, sysUserId int) (i
|
|
|
WHERE cf.user_id = ? AND ca.id = ? ) AS is_follow
|
|
|
FROM
|
|
|
cygx_yanxuan_special_author as a
|
|
|
- LEFT JOIN wx_user AS u ON u.user_id = a.user_id
|
|
|
LEFT JOIN company AS c ON c.company_id = u.company_id WHERE a.id=? `
|
|
|
err = o.Raw(sql, sysUserId, specialColumnId, specialColumnId).QueryRow(&item)
|
|
|
return
|
|
@@ -123,12 +120,9 @@ func GetYanxuanSpecialAuthorList() (items []*CygxYanxuanSpecialAuthorItem, err e
|
|
|
sql := ``
|
|
|
sql = `SELECT
|
|
|
a.*,
|
|
|
- c.company_name,
|
|
|
IFNULL(( SELECT publish_time FROM cygx_yanxuan_special WHERE user_id = a.user_id AND STATUS = 3 ORDER BY publish_time DESC LIMIT 1 ), a.modify_time) AS latest_publish_time
|
|
|
FROM
|
|
|
cygx_yanxuan_special_author AS a
|
|
|
- INNER JOIN wx_user AS u ON u.user_id = a.user_id
|
|
|
- INNER JOIN company AS c ON c.company_id = u.company_id
|
|
|
WHERE
|
|
|
a.nick_name <> ''
|
|
|
ORDER BY
|