Commit 8bbea139 authored by 陈家荣's avatar 陈家荣

Merge branch 'development' of git.wxpai.cn:scrmgroup/pisns-forum-api into development

Conflicts:
	app/controllers/admin/forumThread.js
parents 3e3442e8 672e676a
......@@ -328,14 +328,12 @@ router.post('/thread/comment/update/:cid', function(req, res, next) {
// var commentList = result.comments;
// result.comments = forumThreadService.remove(commentList, cid);
var commentList = result.comments;
var comments = forumThreadService.remove(commentList, cid);
// var commentList = result.comments;
// var comments = forumThreadService.remove(commentList, cid);
forumThreadService.updateThreadById(tid, {
comments: comments,
$inc: {
comment_count: -1
}
"$pull" : { "comments" : { "_id" : cid}},
$inc: { comment_count: -1 }
}, function(err, result) {
if (err) {
console.error(err);
......@@ -365,7 +363,12 @@ router.post('/thread/comment/update/:cid', function(req, res, next) {
var commentList = result.comments;
var comments = forumCommentService.remove(commentList, cid);
forumCommentService.updateCommentById(parent_cid, {
comments: comments
"$pull": {
"comments": {
"_id": cid
}
}
}, function(err, result) {
if (err) {
res.json(returnCode.BUSY);
......@@ -428,15 +431,7 @@ router.post('/thread/comment/update/:cid/comments', function(req, res, next) {
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) {
if (err) {
console.error(err);
res.json(returnCode.BUSY);
} else {
var commentList = result.comments;
result.comments.push(replayComment_id);
forumCommentService.updateCommentById(cid, {
$push: {
......@@ -451,9 +446,33 @@ router.post('/thread/comment/update/:cid/comments', function(req, res, next) {
res.json(returnCode.SUCCESS);
}
});
// 获取评论的子评论列表
// forumCommentService.getCommentById(cid, function(err, result) {
// if (err) {
// console.error(err);
// res.json(returnCode.BUSY);
// } else {
// // var commentList = result.comments;
// // result.comments.push(replayComment_id);
// forumCommentService.updateCommentById(cid, {
// $push: {
// comments: replayComment_id
// }
// },
// function(err, result) {
// if (err) {
// console.error(err);
// res.json(returnCode.BUSY);
// } else {
// 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