Commit 3926e6a1 authored by 陈志良's avatar 陈志良

新版 - 评论返回完整评论

parent 39c167aa
...@@ -447,8 +447,6 @@ router.post('/thread/:tid/share', function(req, res, next) { ...@@ -447,8 +447,6 @@ router.post('/thread/:tid/share', function(req, res, next) {
//新增文章评论 //新增文章评论
router.post('/thread/:tid/comment/add', function(req, res, next) { router.post('/thread/:tid/comment/add', function(req, res, next) {
var userId = req.session.mobileForumUser.userId; var userId = req.session.mobileForumUser.userId;
console.log('!!!!!!!!!!!!!!!!!!!!!!!!!!!');
var data = null;
forumLimitActionRefService.checkLimitActionProhibitionOfSpeech(userId, function(err, isProhibition){ forumLimitActionRefService.checkLimitActionProhibitionOfSpeech(userId, function(err, isProhibition){
if(err){ if(err){
console.error(err); console.error(err);
...@@ -508,7 +506,6 @@ router.post('/thread/:tid/comment/add', function(req, res, next) { ...@@ -508,7 +506,6 @@ router.post('/thread/:tid/comment/add', function(req, res, next) {
if (err) { if (err) {
callback(err, null); callback(err, null);
} else { } else {
data = newComment ;
var comments = thread.comments; var comments = thread.comments;
// console.log('========='); // console.log('=========');
// console.log(comments); // console.log(comments);
...@@ -522,9 +519,9 @@ router.post('/thread/:tid/comment/add', function(req, res, next) { ...@@ -522,9 +519,9 @@ router.post('/thread/:tid/comment/add', function(req, res, next) {
comments: array comments: array
}, function(err, result) { }, function(err, result) {
if (err) { if (err) {
callback(err, null); callback(err, newComment);
} else { } else {
callback(null, null); callback(null, newComment);
} }
}); });
} }
...@@ -561,9 +558,17 @@ router.post('/thread/:tid/comment/add', function(req, res, next) { ...@@ -561,9 +558,17 @@ router.post('/thread/:tid/comment/add', function(req, res, next) {
} }
} }
}); });
var rs = {}; forumCommentService.getPopulateCommentById(results[0]._id, function(err, c) {
rs.data = data; if (err) {
res.json(_.assign(rs, returnCode.SUCCESS)); res.json(returnCode.BUSY);
} else {
console.log(c);
var rs = {};
rs.data = c;
res.json(_.assign(rs, returnCode.SUCCESS));
}
});
} }
}); });
...@@ -845,23 +850,16 @@ router.post('/thread/:tid/comment/:cid/create', function(req, res, next) { ...@@ -845,23 +850,16 @@ router.post('/thread/:tid/comment/:cid/create', function(req, res, next) {
} }
} }
}); });
forumCommentService.getPopulateCommentById(results[0]._id, function(err, c) {
// httpService.sendRequest(req.session.user.ent_code, req.session.openUser.mid, 'reply');
ForumComment.populate(results[0], {
path: 'from to',
select: 'uid nickName icon comments'
}, function(err, c) {
if (err) { if (err) {
res.json(returnCode.BUSY); res.json(returnCode.BUSY);
} else { } else {
var rs = {}; var rs = {};
rs.data = results[0]; rs.data = c;
res.json(_.assign(rs, returnCode.SUCCESS)); res.json(_.assign(rs, returnCode.SUCCESS));
} }
}); });
// res.json(returnCode.SUCCESS);
} }
}); });
} }
...@@ -881,7 +879,6 @@ router.post('/thread/:tid/comment/:cid/create', function(req, res, next) { ...@@ -881,7 +879,6 @@ router.post('/thread/:tid/comment/:cid/create', function(req, res, next) {
} }
}); });
}); });
//更改评论状态为3(删除) //更改评论状态为3(删除)
router.post('/thread/:tid/comment/:cid/disable', function(req, res, next) { router.post('/thread/:tid/comment/:cid/disable', function(req, res, next) {
var user_id = user.getMobileUser(req), var user_id = user.getMobileUser(req),
......
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