Commit c76dbf7f authored by 杨翌文's avatar 杨翌文

1111

parent 43704520
......@@ -722,22 +722,20 @@ function getSubThreads(doc, sort, callback) {
}
function getAllThreadByFidHelp(conditions, pageNo, pageSize, sort, callback) {
console.time('count_cost');
countAllByFid(conditions, function(err, count) {
if (err) {
console.error(err);
callback(err, null);
} else {
console.timeEnd('count_cost');
console.time('threads_cost');
var skip = (pageNo - 1) * pageSize;
var limit = pageSize;
var limit = count - skip > pageSize ? pageSize : (count - skip);
var sortBy = '-topTime -tag_topTime -quality -created';
if (sort) {
sortBy = sort;
}
ForumThread.find(conditions,listThreadFields).populate('from', 'uid mid nickName icon').populate({
ForumThread.find(conditions,listThreadFields).populate('from', 'uid mid nickName icon').populate('info','name icon pv_count').populate({
path: 'tag',select: 'title pv_count'
}).populate({
path: 'comments',
options: {
where:{status:1},
......@@ -750,13 +748,11 @@ function getAllThreadByFidHelp(conditions, pageNo, pageSize, sort, callback) {
console.error(err);
callback(err, null);
} else {
console.timeEnd('threads_cost');
var obj = {};
obj.total = count;
obj.pageNo = pageNo;
obj.pageSize = pageSize;
obj.items = docs;
console.time('comments_cost');
if (docs && docs.length > 0) {
var asyncTasks = [];
......@@ -780,7 +776,6 @@ function getAllThreadByFidHelp(conditions, pageNo, pageSize, sort, callback) {
} else {
obj.items = results;
callback(null, obj);
console.timeEnd('comments_cost');
}
});
......
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