Commit 6f2f683b authored by 陈志良's avatar 陈志良

1

parent 6487f562
......@@ -21,12 +21,12 @@ exports.createComment=function(entity,callback){
//根据ID获取评论
exports.getCommentById=function(cid,callback){
ForumComment.findById(cid, function(err, thread) {
ForumComment.findById(cid, function(err, comment) {
if (err) {
console.error(err);
callback(err,null);
} else {
callback(null,thread);
callback(null,comment);
}
});
};
......@@ -232,7 +232,6 @@ exports.updateCommentCount=function(cid,callback){
});
};
// 查找数组元素下标
function indexOf(array,val) {
for (var i = 0; i < array.length; i++) {
......@@ -249,3 +248,13 @@ exports.remove = function(array,val) {
}
return array;
};
//更改评论状态
exports.changeStatus = function(cid,status,callback){
ForumComment.update(
{_id:cid},
{status:status},
function(err,update){
callback(err,update);
}
);
};
\ No newline at end of file
......@@ -141,8 +141,8 @@ exports.getThreadById = function(tid, callback) {
function(cb) {
var conditions = {
thread: tid,
level: '1',
status:1
level: '1'
// status:1
};
//获取最新10条评论
forumCommentService.getAllComment(conditions, 1, 10, function(err, results) {
......@@ -270,8 +270,8 @@ exports.getThreadByIdNoLimit = function(tid, callback) {
function(cb) {
var conditions = {
thread: tid,
level: '1',
status:1
level: '1'
// status:1
};
//获取最新10条评论
forumCommentService.getAllComment(conditions, 1, 999, function(err, results) {
......@@ -450,7 +450,7 @@ exports.updateThreadById = function(tid, entity, callback) {
//逻辑删除文章
exports.logicDeleteThreadById = function(tid, callback) {
ForumThread.update({
_id: tid
_id: mongoose.Types.ObjectId(tid)
}, {
status : 3
}, null, function(err, result) {
......
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