Commit 3aa04bc0 authored by 杨翌文's avatar 杨翌文

提交修改

parent 05a6088e
......@@ -10,7 +10,7 @@ var forumCommentService = require('./forumCommentService');
var async = require('async');
var then = require('thenjs');
var threadFields = {
var listThreadFields = {
content:1,
type:1,
title:1,
......@@ -28,6 +28,25 @@ var threadFields = {
};
var singleThreadFields = {
content:1,
type:1,
title:1,
pid:1,
from:1,
created:1,
recommend:1,
praise_count:1,
comment_count:1,
images:1,
level:1,
top:1,
address:1
};
var subThreadFields = {
from:1
};
......@@ -192,7 +211,7 @@ exports.getThreadById = function(tid, callback) {
var conditions = {
_id: tid
};
ForumThread.findOne(conditions).populate('from').populate('info').populate('share').exec(function(err, doc) {
ForumThread.findOne(conditions, singleThreadFields).populate('from').populate('info').populate('share').exec(function(err, doc) {
if (err) {
console.error(err);
callback(err, null);
......@@ -326,7 +345,7 @@ exports.getThreadByIdNoLimit = function(tid, callback) {
var conditions = {
_id: tid
};
ForumThread.findOne(conditions).populate('from').populate('info').populate('share').exec(function(err, doc) {
ForumThread.findOne(conditions,singleThreadFields).populate('from').populate('info').populate('share').exec(function(err, doc) {
if (err) {
console.error(err);
callback(err, null);
......@@ -694,7 +713,7 @@ function getAllThreadByFidHelp(conditions, pageNo, pageSize, sort, callback) {
if (sort) {
sortBy = sort;
}
ForumThread.find(conditions,threadFields).populate('from', 'uid mid nickName icon').populate('info', 'name icon pv_count').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',
......@@ -762,7 +781,7 @@ function getAllThreadByFidHelpNoLimit(conditions, pageNo, pageSize, sort, callba
if (sort) {
sortBy = sort;
}
ForumThread.find(conditions,threadFields).populate('from','uid mid nickName icon').populate('info','name icon pv_count').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',
......@@ -1079,7 +1098,7 @@ function getAllThreadByFidAndUserHelp(user_ids, conditions, pageNo, pageSize, so
if (sort) {
sortBy = sort;
}
ForumThread.find(conditions, threadFields).populate('from','uid mid nickName icon').populate('info','name icon pv_count').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',
......
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