Commit 22adf15b authored by 陈家荣's avatar 陈家荣

111

parent ffa6bd1a
...@@ -675,11 +675,9 @@ var getClientIP = function(req) { ...@@ -675,11 +675,9 @@ var getClientIP = function(req) {
//给以前的已一级评论添加楼层 //给以前的已一级评论添加楼层
router.get('/thread/updateConmentFloor', function(req, res, next) { router.get('/thread/updateConmentFloor', function(req, res, next) {
var ent_code = req.session.user.ent_code; res.json(returnCode.SUCCESS);
// var ent_code = req.params.ent_code || null;
if(ent_code){
var conditions = { var conditions = {
ent_code: ent_code // ent_code: ent_code
}; };
async.waterfall([ async.waterfall([
function(callback) { // 查找文章的总数 function(callback) { // 查找文章的总数
...@@ -702,16 +700,16 @@ router.get('/thread/updateConmentFloor', function(req, res, next) { ...@@ -702,16 +700,16 @@ router.get('/thread/updateConmentFloor', function(req, res, next) {
} }
], function (err, result) { ], function (err, result) {
var asyncTasks = []; var asyncTasks = [];
result.items.forEach(function(doc) { //遍历文章 result.items.forEach(function(doc, t) { //遍历文章
asyncTasks.push(function(callback2) { asyncTasks.push(function(callback2) {
//获取文章所有一级评论,倒数排列 //获取文章所有一级评论
var conditions = { var conditions = {
thread: doc._id, thread: doc._id,
level: '1' level: '1'
}; };
async.waterfall([ async.waterfall([
function(callback) { function(callback) {
//获取所有评论 //统计评论数
forumCommentService.count(conditions, function(err, count) { forumCommentService.count(conditions, function(err, count) {
if (err) { if (err) {
console.log(err); console.log(err);
...@@ -744,8 +742,9 @@ router.get('/thread/updateConmentFloor', function(req, res, next) { ...@@ -744,8 +742,9 @@ router.get('/thread/updateConmentFloor', function(req, res, next) {
console.error(err); console.error(err);
// callback(err,null); // callback(err,null);
} else { } else {
// callback(null,null); callback(null,null);
} }
}) })
}); });
} }
...@@ -755,7 +754,7 @@ router.get('/thread/updateConmentFloor', function(req, res, next) { ...@@ -755,7 +754,7 @@ router.get('/thread/updateConmentFloor', function(req, res, next) {
console.error(err); console.error(err);
// callback(err,null); // callback(err,null);
} else { } else {
// callback(null,null); // callback2(null,null);
} }
}); });
}); });
...@@ -766,11 +765,9 @@ router.get('/thread/updateConmentFloor', function(req, res, next) { ...@@ -766,11 +765,9 @@ router.get('/thread/updateConmentFloor', function(req, res, next) {
console.error(err); console.error(err);
res.json(returnCode.BUSY); res.json(returnCode.BUSY);
} else { } else {
// console.log("------------update done!-------------");
res.json(returnCode.SUCCESS); res.json(returnCode.SUCCESS);
} }
}); });
}); });
}else{
res.json(returnCode.BUSY);
}
}); });
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