Commit c917666e authored by 陈家荣's avatar 陈家荣

Merge branch 'development' of git.wxpai.cn:scrmgroup/pisns-forum-api into development

Conflicts:
	app/controllers/mobile/forumThread.js
parents b1b7e6ad 21a75806
This diff is collapsed.
......@@ -253,10 +253,10 @@ exports.getThreadById = function(tid, callback) {
//根据ID更新文章
exports.updateThreadById = function(tid, entity, callback) {
var shareEntity = entity.share || {};
var shareEntity = entity.share;
if (entity.share && entity.share._id) {
entity.share = entity.share._id;
}else{
} else {
entity.share = '';
}
if (entity.share) {
......@@ -283,7 +283,7 @@ exports.updateThreadById = function(tid, entity, callback) {
});
} else {
if (shareEntity.title || shareEntity.description || shareEntity.icon) {
if (shareEntity && (shareEntity.title || shareEntity.description || shareEntity.icon)) {
shareEntity.ent_code = entity.ent_code;
var forumShare = new ForumShare(shareEntity);
......@@ -630,7 +630,7 @@ exports.updateThreadShareCount = function(threadId, callback) {
};
//更新文章评论数
exports.updateThreadCommentCount = function(threadId, callback) {
exports.updateThreadCommentCountInc = function(threadId, callback) {
ForumThread.update({
_id: threadId
}, {
......@@ -651,6 +651,23 @@ exports.updateThreadCommentCount = function(threadId, callback) {
});
};
//更新文章评论数
exports.updateThreadCommentCount = function(threadId, comment_count, callback) {
ForumThread.update({
_id: threadId
}, {
'comment_count': comment_count
}, null,
function(err, result) {
if (err) {
console.error(err);
callback(err, null);
} else {
callback(null, null);
}
});
};
//更新文章浏览数
exports.updateThreadPvCount = function(threadId, callback) {
ForumThread.update({
......@@ -672,3 +689,20 @@ exports.updateThreadPvCount = function(threadId, callback) {
}
});
};
// 查找数组元素下标
function indexOf(array,val) {
for (var i = 0; i < array.length; i++) {
if (array[i] == val) return i;
}
return -1;
};
// 删除数组指定值
exports.remove = function(array,val) {
var index = indexOf(array,val);
if (index > -1) {
array.splice(index, 1);
}
return array;
};
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