...
|
...
|
@@ -9,6 +9,7 @@ const mysqlCli = global.yoho.utils.mysqlCli; |
|
|
|
|
|
const TABLE_ACT_ARTICLE = 'act_article';
|
|
|
const TABLE_ACT_ARTICLE_IMG = 'act_article_img';
|
|
|
const TABLE_ACT_ARTICLE_GOOD = 'act_article_good';
|
|
|
|
|
|
class ArticleModel extends global.yoho.BaseModel {
|
|
|
constructor(ctx) {
|
...
|
...
|
@@ -60,6 +61,25 @@ class ArticleModel extends global.yoho.BaseModel { |
|
|
}
|
|
|
);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取单个文章详情
|
|
|
* @param articleId
|
|
|
* @returns {*}
|
|
|
*/
|
|
|
getSingleArticle(articleId, actId) {
|
|
|
return mysqlCli.query(`select act_article.id,content,good_count,
|
|
|
act_article_img.img_url from ${TABLE_ACT_ARTICLE}
|
|
|
join ${TABLE_ACT_ARTICLE_IMG}
|
|
|
where act_article_img.article_id = act_article.id
|
|
|
and act_article.act_id = :actId
|
|
|
and act_article.id = :articleId;`,
|
|
|
{
|
|
|
actId,
|
|
|
articleId
|
|
|
}
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
module.exports = ArticleModel;
|
...
|
...
|
|