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

222

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