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

接口减肥

parent 68fa8baa
......@@ -10,6 +10,24 @@ var forumCommentService = require('./forumCommentService');
var async = require('async');
var then = require('thenjs');
var threadFields = {
'content':1,
'type':1,
'title':1,
'pid':1,
'from':1,
'created':1,
'recommend':1,
'praise_count':1,
'comment_count':1,
'images':1,
'comments':1,
'level':1,
'top':1,
'address':1
};
//根据发帖者分页查询话题列表
exports.findThreadByPage = function(pageNo, pageSize, q, callback) {
then(function(cont) {
......@@ -611,7 +629,7 @@ function getSubThreads(doc, sort, callback) {
if (sort) {
sortBy = sort;
}
ForumThread.find(conditions).populate('from').sort(sortBy).exec(function(err, docs) {
ForumThread.find(conditions).populate('from', 'uid mid nickName icon').sort(sortBy).exec(function(err, docs) {
if (err) {
console.error(err);
callback(err, null);
......@@ -642,8 +660,8 @@ function getAllThreadByFidHelp(conditions, pageNo, pageSize, sort, callback) {
if (sort) {
sortBy = sort;
}
ForumThread.find(conditions).populate('from').populate('info').populate({
path: 'tag'
ForumThread.find(conditions,threadFields).populate('from', 'uid mid nickName icon').populate('info', 'name icon pv_count').populate({
path: 'tag', select: 'title pv_count'
}).populate({
path: 'comments',
options: {
......@@ -710,8 +728,8 @@ function getAllThreadByFidHelpNoLimit(conditions, pageNo, pageSize, sort, callba
if (sort) {
sortBy = sort;
}
ForumThread.find(conditions).populate('from').populate('info').populate({
path: 'tag'
ForumThread.find(conditions,threadFields).populate('from','uid mid nickName icon').populate('info','name icon pv_count').populate({
path: 'tag',select: 'title pv_count'
}).populate({
path: 'comments',
options: {
......@@ -1027,8 +1045,8 @@ function getAllThreadByFidAndUserHelp(user_ids, conditions, pageNo, pageSize, so
if (sort) {
sortBy = sort;
}
ForumThread.find(conditions).populate('from').populate('info').populate({
path: 'tag'
ForumThread.find(conditions)populate('from','uid mid nickName icon').populate('info','name icon pv_count').populate({
path: 'tag', select: 'title pv_count'
}).populate({
path: 'comments',
options: {
......
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