Commit 1fd82056 authored by 陈家荣's avatar 陈家荣

2222

parent 66894048
......@@ -28,6 +28,7 @@ var checkLimitAction = function(req) {
res.json('success');
} else {
// 获取到用户行为限制记录
if(forumLimitActionRef){
var limit_actions = forumLimitActionRef.limit_actions;
for (var i = 0; i < limit_actions.length; i += 1) {
var limit_action = limit_actions[i];
......@@ -40,6 +41,9 @@ var checkLimitAction = function(req) {
req.session.mobileForumUser.limit_actions.push(obj);
res.json('success');
}
}else{
res.json('success');
}
}
});
}else{
......
......@@ -14,21 +14,21 @@ module.exports = function(app) {
};
//格式化日期 (格式:年-月-日)
function date_format(date) {
return moment(date).format('YYYY/MM/DD');
}
// function date_format(date) {
// return moment(date).format('YYYY-MM-DD');
// }
//判断时间是否在指定范围
function compareTime(now, begin_time, end_time) {
now = date_format(now);
begin_time = date_format(begin_time);
end_time = date_format(end_time);
if (moment(now).isSame(begin_time) || moment(now).isSame(end_time)) { //如果等于开始时间或者结束时间
return true;
} else {
return moment(now).isBetween(begin_time, end_time);
}
}
// function compareTime(now, begin_time, end_time) {
// now = date_format(now);
// begin_time = date_format(begin_time);
// end_time = date_format(end_time);
// if (moment(now).isSame(begin_time) || moment(now).isSame(end_time)) { //如果等于开始时间或者结束时间
// return true;
// } else {
// return moment(now).isBetween(begin_time, end_time);
// }
// }
//新增或更新论坛行为限制
router.post('/limitActionRef/createOrUpdate', function(req, res, next) {
......@@ -50,8 +50,8 @@ router.post('/limitActionRef/createOrUpdate', function(req, res, next) {
for (var i in selects) {
for (var j in results) {
if (selects[i] === results[j]._id.toString()) {
var begin_time = moment().format('YYYY-MM-DD');
var end_time = moment().add(results[j].limit_time, 'days').format('YYYY-MM-DD');
var begin_time = moment(new Date()).format('YYYY-MM-DD');
var end_time = moment(new Date()).add(results[j].limit_time, 'days').format('YYYY-MM-DD');
var obj = {
limit_action: selects[i],
limit_action_type: results[j].limit_action_type,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment