Commit 8f898948 authored by 陈志良's avatar 陈志良

1

parent be521c4b
......@@ -257,4 +257,35 @@ exports.changeStatus = function(cid,status,callback){
callback(err,update);
}
);
};
//获取评论列表
exports.getCommentList = function(conditions,pageNo,pageSize,callback){
countAll(conditions,function(err,count){
if(err){
callback(err);
}else{
var skip = (pageNo - 1) * pageSize;
var limit = count - skip > pageSize ? pageSize : (count - skip);
ForumComment.find(conditions).populate('from').populate('to').limit(limit).skip(skip).sort('-created').exec(function(err, docs) {
if (err) {
console.error(err);
callback(err,null);
} else {
var obj={};
obj.total=count;
obj.pageNo=pageNo;
obj.pageSize=pageSize;
obj.items=docs;
callback(null,obj);
}
});
}
});
};
exports.getCommentParent = function(cid,callback){
ForumComment.findOne({comments:{$in:[cid]}},function(err,doc){
callback(err,doc);
});
};
\ No newline at end of file
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