Commit 2a9a5b2d authored by 陈家荣's avatar 陈家荣

修改获取帖子列表

parent 1d7327e0
......@@ -1815,7 +1815,13 @@ router.get('/thread/getThreadWithEssence', function(req, res, next) {
results.items[i].eventStatus = 1; //'进行中';
}
}
//获取等级最高的荣誉
if(results.items[i].from.honorTitles && results.items[i].from.honorTitles.length > 0){
var temp_honorTitles = _.sortBy(results.items[i].from.honorTitles, 'order_idx')
results.items[i].from.honorTitles = temp_honorTitles[temp_honorTitles.length - 1];
}
results.items[i].isPraise = false;
for (var k = docs.length - 1; k >= 0; k--) {
if (results.items[i]._id == docs[k]) {
......@@ -1867,7 +1873,7 @@ router.get('/thread/searchThread', function(req, res, next) {
router.get('/thread/getThreadWithNotPopulateComment', function(req, res, next) {
var pageNo = req.query.pageNo || 1;
var pageSize = req.query.pageSize || 10;
var sort = '-top -topTime -quality -created';
var sort = '-created';
var ent_code = req.session.user.ent_code;
var today = new Date();
var conditions = {
......@@ -1903,6 +1909,13 @@ router.get('/thread/getThreadWithNotPopulateComment', function(req, res, next) {
results.items[i].eventStatus = 1; //'进行中';
}
}
//获取等级最高的荣誉
if(results.items[i].from.honorTitles && results.items[i].from.honorTitles.length > 0){
var temp_honorTitles = _.sortBy(results.items[i].from.honorTitles, 'order_idx')
results.items[i].from.honorTitles = temp_honorTitles[temp_honorTitles.length - 1];
}
results.items[i].isPraise = false;
for (var k = docs.length - 1; k >= 0; k--) {
if (results.items[i]._id == docs[k]) {
......
......@@ -1287,16 +1287,19 @@ exports.getThreadWithNotPopulateComment = function(conditions, pageNo, pageSize,
obj.pageNo = pageNo;
obj.pageSize = pageSize;
obj.items = docs;
if (docs && docs.length > 0) {
var asyncTasks = [];
docs.forEach(function(doc) {
if (!(doc.type === 1 || doc.level !== 1)) { //照片墙或文章时获取参与用户
if (doc.type === 1 || doc.level !== 1) { //非照片墙或文章时获取评论
asyncTasks.push(function(callback) {
callback(null, doc);
});
} else {
asyncTasks.push(function(callback) {
getSubThreads(doc, null, callback);
});
}
}
});
async.parallel(asyncTasks, function(err, results) {
if (err) {
......
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