v1.18.x
Julian Lam 11 years ago
parent 90352cd858
commit 6514504ddd

@ -136,16 +136,23 @@ var db = require('./database'),
topics.getTopicsByTids(tids, cid, uid, next); topics.getTopicsByTids(tids, cid, uid, next);
}, },
function(topics, next) { function(topics, next) {
db.sortedSetRevRank('categories:' + cid + ':tid', topics[topics.length - 1].tid, function(err, rank) { if (topics && topics.length > 0) {
if(err) { db.sortedSetRevRank('categories:' + cid + ':tid', topics[topics.length - 1].tid, function(err, rank) {
return next(err); if(err) {
} return next(err);
}
return next(null, { next(null, {
topics: topics,
nextStart: parseInt(rank, 10) + 1
});
});
} else {
next(null, {
topics: topics, topics: topics,
nextStart: parseInt(rank, 10) + 1 nextStart: 1
}); });
}); }
} }
], callback); ], callback);
}; };

Loading…
Cancel
Save