Commit bc504856 authored by 陈志良's avatar 陈志良

1

parent f4858ecf
......@@ -616,19 +616,16 @@ router.post('/thread/:tid/comment/create', function(req, res, next) {
});
//新增文章评论
router.post('/thread/:tid/comment/createv2', function(req, res, next) {
console.log('------------------in------------------');
var userId = req.session.mobileForumUser.userId;
var data = null;
forumLimitActionRefService.checkLimitActionProhibitionOfSpeech(userId, function(err, isProhibition){
console.log('1');
if(err){
console.error(err);
res.json(returnCode.PROHIBITION_OF_SPEECH);
}else{
console.log('2');
if(isProhibition){
res.json(returnCode.PROHIBITION_OF_SPEECH);
}else{
console.log('3');
var tid = req.params.tid || null;
if (tid) {
var integral = req.session.openUser.integral || 0;
......@@ -680,6 +677,7 @@ router.post('/thread/:tid/comment/createv2', function(req, res, next) {
if (err) {
callback(err, null);
} else {
data = newComment ;
var comments = thread.comments;
// console.log('=========');
// console.log(comments);
......@@ -732,43 +730,9 @@ router.post('/thread/:tid/comment/createv2', function(req, res, next) {
}
}
});
async.parallel([
function(callback) {
//获取最新5条评论
var conditions = {
thread: tid,
level: '1'
};
forumCommentService.getAllComment(conditions, 1, 5, function(err, results) {
if (err) {
console.log(err);
callback(err, null);
} else {
callback(null, results);
}
});
},
function(callback) {
forumThreadService.getThreadById(tid, function(err, thread) {
if (err) {
console.log(err);
callback(err, null);
} else {
callback(null, thread);
}
});
}
], function(err, results) {
if (err) {
res.json(returnCode.BUSY);
} else {
var rs = {};
rs.comments = results[0].items;
rs.commentCount = results[1].comment_count;
res.json(_.assign(rs, returnCode.SUCCESS));
}
});
var rs = {};
rs.data = data;
res.json(_.assign(rs, 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