Commit 1d245410 authored by 杨翌文's avatar 杨翌文

1

parent 530e2846
...@@ -722,11 +722,14 @@ function getSubThreads(doc, sort, callback) { ...@@ -722,11 +722,14 @@ function getSubThreads(doc, sort, callback) {
} }
function getAllThreadByFidHelp(conditions, pageNo, pageSize, sort, callback) { function getAllThreadByFidHelp(conditions, pageNo, pageSize, sort, callback) {
console.time('count_cost');
countAllByFid(conditions, function(err, count) { countAllByFid(conditions, function(err, count) {
if (err) { if (err) {
console.error(err); console.error(err);
callback(err, null); callback(err, null);
} else { } else {
console.timeEnd('count_cost');
console.time('threads_cost');
var skip = (pageNo - 1) * pageSize; var skip = (pageNo - 1) * pageSize;
var limit = pageSize; var limit = pageSize;
var sortBy = '-topTime -tag_topTime -quality -created'; var sortBy = '-topTime -tag_topTime -quality -created';
...@@ -748,12 +751,13 @@ function getAllThreadByFidHelp(conditions, pageNo, pageSize, sort, callback) { ...@@ -748,12 +751,13 @@ function getAllThreadByFidHelp(conditions, pageNo, pageSize, sort, callback) {
console.error(err); console.error(err);
callback(err, null); callback(err, null);
} else { } else {
console.timeEnd('threads_cost');
var obj = {}; var obj = {};
obj.total = count; obj.total = count;
obj.pageNo = pageNo; obj.pageNo = pageNo;
obj.pageSize = pageSize; obj.pageSize = pageSize;
obj.items = docs; obj.items = docs;
console.time('comments_cost');
if (docs && docs.length > 0) { if (docs && docs.length > 0) {
var asyncTasks = []; var asyncTasks = [];
...@@ -777,6 +781,7 @@ function getAllThreadByFidHelp(conditions, pageNo, pageSize, sort, callback) { ...@@ -777,6 +781,7 @@ function getAllThreadByFidHelp(conditions, pageNo, pageSize, sort, callback) {
} else { } else {
obj.items = results; obj.items = results;
callback(null, obj); 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