...
|
...
|
@@ -10,6 +10,14 @@ const AdminModel = require('../models/admin'); |
|
|
const POST_SUCCESS = '操作成功';
|
|
|
const INVALID_PARAMS = '参数错误';
|
|
|
|
|
|
const timeFormat = (time) => {
|
|
|
if (_.isNumber(time)) {
|
|
|
time = moment.unix(time);
|
|
|
}
|
|
|
|
|
|
return moment(time).format('YYYY-MM-DD HH:mm:ss');
|
|
|
};
|
|
|
|
|
|
const article = {
|
|
|
/**
|
|
|
* 首页
|
...
|
...
|
@@ -124,20 +132,14 @@ const article = { |
|
|
* @param next
|
|
|
*/
|
|
|
activityListPage(req, res, next) {
|
|
|
const _timeFormat = (time) => {
|
|
|
if (_.isNumber(time)) {
|
|
|
time = moment.unix(time);
|
|
|
}
|
|
|
|
|
|
return moment(time).format('YYYY-MM-DD HH:mm:ss');
|
|
|
};
|
|
|
|
|
|
req.ctx(AdminModel).activityList()
|
|
|
.then(result => {
|
|
|
_.each(result, item => {
|
|
|
item.endTime = _timeFormat(item.endTime);
|
|
|
item.startTime = _timeFormat(item.startTime);
|
|
|
item.createTime = _timeFormat(item.createTime);
|
|
|
item.endTime = timeFormat(item.endTime);
|
|
|
item.startTime = timeFormat(item.startTime);
|
|
|
item.createTime = timeFormat(item.createTime);
|
|
|
});
|
|
|
|
|
|
res.render('activity/list', {
|
...
|
...
|
@@ -234,6 +236,9 @@ const article = { |
|
|
|
|
|
req.ctx(AdminModel).actArticleList(actId)
|
|
|
.then(result => {
|
|
|
_.each(result, item => {
|
|
|
item.createTime = timeFormat(item.createTime);
|
|
|
});
|
|
|
res.render('activity/article-list', {
|
|
|
bodyClass: 'nav-md',
|
|
|
articleList: result,
|
...
|
...
|
|