Commit 0d2cbf75 authored by 陈家荣's avatar 陈家荣

222

parent c34985e1
......@@ -16,7 +16,7 @@ module.exports = function(app) {
//新增或更新论坛行为限制
router.post('/limitActionRef/createOrUpdate', function(req, res, next) {
var ent_code = req.session.user.ent_code;
var mid = req.body.mid;
var userId = req.body.userId;
var selects = req.body.selects;
var limit_actions = [];
......@@ -50,12 +50,12 @@ router.post('/limitActionRef/createOrUpdate', function(req, res, next) {
}
var forumLimitActionRef = {
ent_code: ent_code,
mid: mid,
userId: userId,
limit_actions: limit_actions
}
forumLimitActionRefService.createOrUpdateLimitActionRef({
mid: mid,
userId: userId,
ent_code: ent_code,
status: 1
}, forumLimitActionRef, function(err, forum) {
......@@ -72,11 +72,11 @@ router.post('/limitActionRef/createOrUpdate', function(req, res, next) {
})
});
//根据mid获取论坛行为限制
router.get('/limitActionRef/:mid/get', function(req, res, next) {
var mid = req.params.mid;
if (mid) {
forumLimitActionRefService.getLimitActionRefByMid(mid, function(err, forumLimitActionRef) {
//根据userId获取论坛行为限制
router.get('/limitActionRef/:userId/get', function(req, res, next) {
var userId = req.params.userId;
if (userId) {
forumLimitActionRefService.getLimitActionRefByMid(userId, function(err, forumLimitActionRef) {
if (err) {
console.error(err);
res.json(returnCode.BUSY);
......@@ -91,61 +91,29 @@ router.get('/limitActionRef/:mid/get', function(req, res, next) {
}
});
//删除论坛行为限制
router.post('/limitActionRef/:rid/delete', function(req, res, next) {
var rid = req.params.rid;
if (rid) {
forumLimitActionRefService.deleteLimitActionRefById(rid, function(err, result) {
if (err) {
console.error(err);
res.json(returnCode.BUSY);
} else {
res.json(returnCode.SUCCESS);
}
});
} else {
res.json(returnCode.WRONG_PARAM);
}
});
//更新论坛行为限制
router.post('/limitActionRef/:rid/update', function(req, res, next) {
var rid = req.params.rid;
if (rid) {
forumLimitActionRefService.updateLimitActionRefById(rid, req.body, function(err, result) {
if (err) {
console.error(err);
res.json(returnCode.BUSY);
} else {
res.json(returnCode.SUCCESS);
}
});
} else {
res.json(returnCode.WRONG_PARAM);
}
});
//获取行为限制列表
router.get('/limitActionRef/list', function(req, res, next) {
var pageNo = req.query.pageNo || 1;
var pageSize = req.query.pageSize || 10;
var limitActionName = req.query.limitActionName;
// router.get('/limitActionRef/list', function(req, res, next) {
// var pageNo = req.query.pageNo || 1;
// var pageSize = req.query.pageSize || 10;
// var limitActionName = req.query.limitActionName;
var conditions = {
ent_code: req.session.user.ent_code
};
if (limitActionName) {
conditions.title = {
$regex: limitActionName,
$options: 'i'
};
}
forumLimitActionRefService.getAllLimitActionRef(conditions, pageNo, pageSize, function(err, results) {
if (err) {
console.error(err);
res.json(returnCode.BUSY);
} else {
res.json(_.assign(results, returnCode.SUCCESS));
}
});
});
// var conditions = {
// ent_code: req.session.user.ent_code
// };
// if (limitActionName) {
// conditions.title = {
// $regex: limitActionName,
// $options: 'i'
// };
// }
// forumLimitActionRefService.getAllLimitActionRef(conditions, pageNo, pageSize, function(err, results) {
// if (err) {
// console.error(err);
// res.json(returnCode.BUSY);
// } else {
// res.json(_.assign(results, returnCode.SUCCESS));
// }
// });
// });
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