Commit 16d2dc7c authored by 陈志良's avatar 陈志良

1

parent d062633c
...@@ -616,31 +616,36 @@ router.post('/thread/:tid/comment/create', function(req, res, next) { ...@@ -616,31 +616,36 @@ router.post('/thread/:tid/comment/create', function(req, res, next) {
}); });
//新增文章评论 //新增文章评论
router.post('/thread/:tid/comment/create/new', function(req, res, next) { router.post('/thread/:tid/comment/create/new', function(req, res, next) {
console.log('------------------in------------------');
var userId = req.session.mobileForumUser.userId; var userId = req.session.mobileForumUser.userId;
forumLimitActionRefService.checkLimitActionProhibitionOfSpeech(userId, function(err, isProhibition){ forumLimitActionRefService.checkLimitActionProhibitionOfSpeech(userId, function(err, isProhibition){
console.log('1');
if(err){ if(err){
console.error(err); console.error(err);
res.json(returnCode.PROHIBITION_OF_SPEECH); res.json(returnCode.PROHIBITION_OF_SPEECH);
}else{ }else{
console.log('2');
if(isProhibition){ if(isProhibition){
res.json(returnCode.PROHIBITION_OF_SPEECH); res.json(returnCode.PROHIBITION_OF_SPEECH);
}else{ }else{
console.log('3');
var tid = req.params.tid || null; var tid = req.params.tid || null;
if (tid) { if (tid) {
var integral = req.session.openUser.integral || 0; var integral = req.session.openUser.integral || 0;
var exp = req.session.openUser.exp || 0; var exp = req.session.openUser.exp || 0;
var destination = req.body.destination || '1'; var destination = req.body.destination || '1';
//1.检查是否有权限 //1.检查是否有权限
forumRolePermissionService.checkRolePermiss(req.session.user.ent_code, 'comment', integral, exp, function(err, result) { // forumRolePermissionService.checkRolePermiss(req.session.user.ent_code, 'comment', integral, exp, function(err, result) {
if (err) { // if (err) {
console.error(err); // console.error(err);
res.json(returnCode.BUSY); // res.json(returnCode.BUSY);
} else { // } else {
if (result) { //有操作权限 // if (result) { //有操作权限
var content = req.body.content; var content = req.body.content;
if (content) { //评论不能为空 if (content) { //评论不能为空
//2.获取论坛文章 //2.获取论坛文章
forumThreadService.getThreadById(tid, function(err, thread) { forumThreadService.getThreadById(tid, function(err, thread) {
console.log(err);
if (err) { if (err) {
res.json(returnCode.BUSY); res.json(returnCode.BUSY);
} else { } else {
...@@ -772,11 +777,11 @@ router.post('/thread/:tid/comment/create/new', function(req, res, next) { ...@@ -772,11 +777,11 @@ router.post('/thread/:tid/comment/create/new', function(req, res, next) {
} else { } else {
res.json(returnCode.WRONG_PARAM); res.json(returnCode.WRONG_PARAM);
} }
} else { // } else {
res.json(returnCode.ACTION_NOT_PERMISSION); // res.json(returnCode.ACTION_NOT_PERMISSION);
} // }
} // }
}); // });
} else { } else {
res.json(returnCode.WRONG_PARAM); res.json(returnCode.WRONG_PARAM);
} }
......
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