Commit a32fda54 authored by 陈家荣's avatar 陈家荣

更新后台回复评论时评论数不对BUG

parent 8d924e48
...@@ -650,9 +650,13 @@ router.get('/thread/:tid/comment/list', function(req, res, next) { ...@@ -650,9 +650,13 @@ router.get('/thread/:tid/comment/list', function(req, res, next) {
cb(null, e); cb(null, e);
} else { } else {
forumCommentService.getCommentParent(e._id, function(err, p_comment) { forumCommentService.getCommentParent(e._id, function(err, p_comment) {
var comment = e.toObject(); if(p_comment){
comment.floor = p_comment.floor; var comment = e.toObject();
cb(null, comment); comment.floor = p_comment.floor;
cb(null, comment);
}else{
cb(null, e);
}
}); });
} }
}); });
...@@ -920,11 +924,11 @@ router.post('/thread/comment/update/:cid/comments', function(req, res, next) { ...@@ -920,11 +924,11 @@ router.post('/thread/comment/update/:cid/comments', function(req, res, next) {
// 获取评论的子评论列表 // 获取评论的子评论列表
// 更新文章评论 + 1 // 更新文章评论 + 1
forumThreadService.updateThreadCommentCountInc(tid, function(err, thread) { // forumThreadService.updateThreadCommentCountInc(tid, function(err, thread) {
if (err) { // if (err) {
console.error(err); // console.error(err);
} // }
}); // });
// 更新评论对象 // 更新评论对象
// result.comment_count+=1; // 回复评论+1 // result.comment_count+=1; // 回复评论+1
forumCommentService.updateCommentById(cid, { forumCommentService.updateCommentById(cid, {
......
...@@ -694,7 +694,7 @@ router.post('/thread/:tid/delete', function(req, res, next) { ...@@ -694,7 +694,7 @@ router.post('/thread/:tid/delete', function(req, res, next) {
//文章点赞和取消点赞 //文章点赞和取消点赞
router.post('/thread/:tid/praiseOrCancelPraise', function(req, res, next) { router.post('/thread/:tid/praiseOrCancelPraise', function(req, res, next) {
var userId = req.session.mobileForumUser.userId; var userId = user.getMobileUser(req);
var mid = req.session.openUser.mid; var mid = req.session.openUser.mid;
var tid = req.params.tid || null; var tid = req.params.tid || null;
var ent_code = req.session.user.ent_code; var ent_code = req.session.user.ent_code;
......
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