|
@@ -936,6 +936,63 @@ func GetArticleResearchList(condition string, pars []interface{}, startSize, pag
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+func GetArticleResearchListYx(condition string, pars []interface{}, startSize, pageSize, userId int, needYanxuanSpecial bool) (items []*ArticleListResp, err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ sql := `SELECT
|
|
|
+ a.article_id,
|
|
|
+ a.title,
|
|
|
+ a.publish_date AS publish_time,
|
|
|
+ a.article_type_id,
|
|
|
+ d.nick_name,
|
|
|
+ d.department_id,
|
|
|
+ 0 AS is_special,
|
|
|
+ 0 as pv,
|
|
|
+ 0 as collect_num,
|
|
|
+ 0 AS special_type,
|
|
|
+ 0 AS user_id,
|
|
|
+ '' AS company_tags,
|
|
|
+ '' AS industry_tags
|
|
|
+ FROM
|
|
|
+ cygx_article AS a
|
|
|
+ INNER JOIN cygx_article_department AS d ON d.department_id = a.department_id
|
|
|
+ WHERE
|
|
|
+ 1 = 1 AND a.publish_status = 1
|
|
|
+ `
|
|
|
+ if condition != "" {
|
|
|
+ sql += condition
|
|
|
+ }
|
|
|
+ sql += ` GROUP BY a.article_id `
|
|
|
+ if needYanxuanSpecial {
|
|
|
+ sql += `UNION ALL
|
|
|
+ SELECT
|
|
|
+ a.id AS article_id,
|
|
|
+ a.title AS title,
|
|
|
+ a.publish_time AS publish_time,
|
|
|
+ -1 AS article_type_id,
|
|
|
+ b.nick_name AS nick_name,
|
|
|
+ a.user_id AS department_id,
|
|
|
+ 1 AS is_special,
|
|
|
+ a.pv,
|
|
|
+ a.article_collect_num as collect_num,
|
|
|
+ a.type AS special_type,
|
|
|
+ a.user_id AS user_id,
|
|
|
+ a.company_tags AS company_tags,
|
|
|
+ a.industry_tags AS industry_tags
|
|
|
+ FROM
|
|
|
+ cygx_yanxuan_special AS a
|
|
|
+ JOIN cygx_yanxuan_special_author AS b ON a.user_id = b.user_id
|
|
|
+ WHERE
|
|
|
+ 1 = 1 AND a.status = 3 `
|
|
|
+ sql += ` ORDER BY publish_time DESC LIMIT ?,? `
|
|
|
+ _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
|
|
|
+ } else {
|
|
|
+ sql += ` ORDER BY publish_time DESC LIMIT ?,? `
|
|
|
+ _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
|
|
|
+ }
|
|
|
+
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
func GetArticleResearchAndYxSpecialList(condition, conditionYxSpecial string, pars []interface{}, startSize, pageSize, userId int, needYanxuanSpecial bool) (total int, items []*ArticleListResp, err error) {
|
|
|
o := orm.NewOrm()
|
|
|
sql := `SELECT
|