...
|
...
|
@@ -25,13 +25,16 @@ class AdminModel extends global.yoho.BaseModel { |
|
|
* @param endTime 活动结束时间
|
|
|
* @returns {*}
|
|
|
*/
|
|
|
createActivity({title, startTime, endTime}) {
|
|
|
createActivity({title, startTime, endTime, repeat_limit, vote_limit}) {
|
|
|
return mysqlCli.insert(
|
|
|
`insert into ${TB_ACTIVITY} (title, start_time, end_time) values (:title, :startTime, :endTime);`,
|
|
|
`insert into ${TB_ACTIVITY} (title, start_time, end_time, repeat_limit, vote_limit)
|
|
|
values (:title, :startTime, :endTime, :repeat_limit, :vote_limit);`,
|
|
|
{
|
|
|
title,
|
|
|
startTime,
|
|
|
endTime
|
|
|
endTime,
|
|
|
repeat_limit,
|
|
|
vote_limit
|
|
|
}
|
|
|
);
|
|
|
}
|
...
|
...
|
@@ -42,7 +45,8 @@ class AdminModel extends global.yoho.BaseModel { |
|
|
*/
|
|
|
activityList() {
|
|
|
return mysqlCli.query(
|
|
|
`select id, title, start_time startTime, end_time endTime, create_time createTime from ${TB_ACTIVITY};`
|
|
|
`select id, title, start_time startTime, end_time endTime, create_time createTime,
|
|
|
repeat_limit repeatLimit, vote_limit voteLimit from ${TB_ACTIVITY};`
|
|
|
);
|
|
|
}
|
|
|
|
...
|
...
|
@@ -72,11 +76,13 @@ class AdminModel extends global.yoho.BaseModel { |
|
|
limitSql = 'limit :start, :page';
|
|
|
|
|
|
return mysqlCli.query(
|
|
|
`select taa.id, taa.content, taa.create_time createTime, taa.good_count goodCount,
|
|
|
tu.user_name userName, tu.user_phone phone
|
|
|
`select taa.id, taai.img_url imgUrl, taa.content, taa.create_time createTime, taa.good_count goodCount,
|
|
|
taa.user_name userName, tu.user_phone phone
|
|
|
from ${TB_ACT_ARTICLE} taa
|
|
|
left join ${TB_USER} tu
|
|
|
on taa.user_id = tu.id
|
|
|
left join ${TB_ACT_ARTICLE_IMG} taai
|
|
|
on taai.article_id = taa.id
|
|
|
where act_id = :actId
|
|
|
${orderSql} ${limitSql};`, {
|
|
|
actId,
|
...
|
...
|
@@ -123,10 +129,11 @@ class AdminModel extends global.yoho.BaseModel { |
|
|
* @param id 文章ID
|
|
|
* @returns {*}
|
|
|
*/
|
|
|
createArticle({actId, userName, content, createTime}) {
|
|
|
createArticle(actId, userName, content, createTime) {
|
|
|
return mysqlCli.insert(
|
|
|
`insert into ${TB_ACT_ARTICLE}
|
|
|
(act_id, user_name, content, create_time) values (:actId, :userName, :content, :createTime);`,
|
|
|
(act_id, user_name, content, create_time) values
|
|
|
(:actId, :userName, :content, :createTime);`,
|
|
|
{
|
|
|
actId,
|
|
|
userName,
|
...
|
...
|
|