Commit 3f5ad0b3 authored by 陈志良's avatar 陈志良

1

parent feffc644
......@@ -81,9 +81,7 @@ router.post('/thread/create', function(req, res, next) {
}
});
}
});
}
}
}); } }
});
});
......@@ -357,28 +355,21 @@ router.post('/thread/comment/update/:cid/comments', function(req, res, next) {
var cid = req.params.cid || null;
var replayComment_id = req.body.replayComment_id;
// 获取评论的子评论列表
forumCommentService.getCommentById(cid, function(err, result) {
// 更新文章评论 + 1
forumThreadService.updateThreadCommentCountInc(tid, function(err, thread) {
if (err) {
console.error(err);
callback(err, null);
}
});
// 更新评论对象
// result.comment_count+=1; // 回复评论+1
forumCommentService.updateCommentById(cid, {$push:{comments:replayComment_id},$inc:{comment_count:1}}, function(err, result) {
if (err) {
console.error(err);
res.json(returnCode.BUSY);
} else {
// 更新文章评论 + 1
forumThreadService.updateThreadCommentCountInc(tid, function(err, thread) {
if (err) {
callback(err, null);
}
});
// 更新评论对象
result.comments.push(replayComment_id); // 添加子评论ID
// result.comment_count+=1; // 回复评论+1
forumCommentService.updateCommentById(cid, result, function(err, result) {
if (err) {
res.json(returnCode.BUSY);
} else {
res.json(returnCode.SUCCESS);
}
});
res.json(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