...
|
...
|
@@ -7,6 +7,8 @@ |
|
|
const mysqlCli = global.yoho.utils.mysqlCli;
|
|
|
|
|
|
const TABLE_ACTIVITY = 'activity';
|
|
|
const TABLE_ACT_ARTICLE = 'act_article';
|
|
|
const TABLE_USER = 'user';
|
|
|
|
|
|
class AdminModel extends global.yoho.BaseModel {
|
|
|
constructor(ctx) {
|
...
|
...
|
@@ -54,6 +56,54 @@ class AdminModel extends global.yoho.BaseModel { |
|
|
}
|
|
|
);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 活动文章列表
|
|
|
* @returns {*}
|
|
|
*/
|
|
|
actArticleList(actId) {
|
|
|
return mysqlCli.query(
|
|
|
`select taa.id, taa.content, taa.good_count goodCount, tu.user_name userName
|
|
|
from ${TABLE_ACT_ARTICLE} taa
|
|
|
inner join ${TABLE_USER} tu
|
|
|
on taa.user_id = tu.id
|
|
|
where act_id = :actId;`, {
|
|
|
actId
|
|
|
}
|
|
|
);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 删除文章
|
|
|
* @param id 文章ID
|
|
|
* @returns {*}
|
|
|
*/
|
|
|
deleteArticle(id) {
|
|
|
return mysqlCli.delete(
|
|
|
`delete from ${TABLE_ACT_ARTICLE} where id = :id;`,
|
|
|
{
|
|
|
id
|
|
|
}
|
|
|
);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 参与活动用户列表
|
|
|
* @returns {*}
|
|
|
*/
|
|
|
activityUserList(actId) {
|
|
|
return mysqlCli.query(
|
|
|
`select tu.user_phone phone
|
|
|
from ${TABLE_ACTIVITY} ta
|
|
|
inner join act_article taa
|
|
|
on ta.id = taa.act_id
|
|
|
inner join user tu
|
|
|
on taa.user_id = tu.id
|
|
|
where ta.id = :actId;`, {
|
|
|
actId
|
|
|
}
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
module.exports = AdminModel;
|
...
|
...
|
|