Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pisns-forum-api
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
scrmGroup
pisns-forum-api
Commits
6f2f683b
Commit
6f2f683b
authored
Jul 21, 2015
by
陈志良
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
6487f562
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
8 deletions
+17
-8
forumCommentService.js
app/service/forumCommentService.js
+12
-3
forumThreadService.js
app/service/forumThreadService.js
+5
-5
No files found.
app/service/forumCommentService.js
View file @
6f2f683b
...
@@ -21,12 +21,12 @@ exports.createComment=function(entity,callback){
...
@@ -21,12 +21,12 @@ exports.createComment=function(entity,callback){
//根据ID获取评论
//根据ID获取评论
exports
.
getCommentById
=
function
(
cid
,
callback
){
exports
.
getCommentById
=
function
(
cid
,
callback
){
ForumComment
.
findById
(
cid
,
function
(
err
,
thread
)
{
ForumComment
.
findById
(
cid
,
function
(
err
,
comment
)
{
if
(
err
)
{
if
(
err
)
{
console
.
error
(
err
);
console
.
error
(
err
);
callback
(
err
,
null
);
callback
(
err
,
null
);
}
else
{
}
else
{
callback
(
null
,
thread
);
callback
(
null
,
comment
);
}
}
});
});
};
};
...
@@ -232,7 +232,6 @@ exports.updateCommentCount=function(cid,callback){
...
@@ -232,7 +232,6 @@ exports.updateCommentCount=function(cid,callback){
});
});
};
};
// 查找数组元素下标
// 查找数组元素下标
function
indexOf
(
array
,
val
)
{
function
indexOf
(
array
,
val
)
{
for
(
var
i
=
0
;
i
<
array
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
array
.
length
;
i
++
)
{
...
@@ -248,4 +247,14 @@ exports.remove = function(array,val) {
...
@@ -248,4 +247,14 @@ exports.remove = function(array,val) {
array
.
splice
(
index
,
1
);
array
.
splice
(
index
,
1
);
}
}
return
array
;
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
app/service/forumThreadService.js
View file @
6f2f683b
...
@@ -141,8 +141,8 @@ exports.getThreadById = function(tid, callback) {
...
@@ -141,8 +141,8 @@ exports.getThreadById = function(tid, callback) {
function
(
cb
)
{
function
(
cb
)
{
var
conditions
=
{
var
conditions
=
{
thread
:
tid
,
thread
:
tid
,
level
:
'1'
,
level
:
'1'
status
:
1
//
status:1
};
};
//获取最新10条评论
//获取最新10条评论
forumCommentService
.
getAllComment
(
conditions
,
1
,
10
,
function
(
err
,
results
)
{
forumCommentService
.
getAllComment
(
conditions
,
1
,
10
,
function
(
err
,
results
)
{
...
@@ -270,8 +270,8 @@ exports.getThreadByIdNoLimit = function(tid, callback) {
...
@@ -270,8 +270,8 @@ exports.getThreadByIdNoLimit = function(tid, callback) {
function
(
cb
)
{
function
(
cb
)
{
var
conditions
=
{
var
conditions
=
{
thread
:
tid
,
thread
:
tid
,
level
:
'1'
,
level
:
'1'
status
:
1
//
status:1
};
};
//获取最新10条评论
//获取最新10条评论
forumCommentService
.
getAllComment
(
conditions
,
1
,
999
,
function
(
err
,
results
)
{
forumCommentService
.
getAllComment
(
conditions
,
1
,
999
,
function
(
err
,
results
)
{
...
@@ -450,7 +450,7 @@ exports.updateThreadById = function(tid, entity, callback) {
...
@@ -450,7 +450,7 @@ exports.updateThreadById = function(tid, entity, callback) {
//逻辑删除文章
//逻辑删除文章
exports
.
logicDeleteThreadById
=
function
(
tid
,
callback
)
{
exports
.
logicDeleteThreadById
=
function
(
tid
,
callback
)
{
ForumThread
.
update
({
ForumThread
.
update
({
_id
:
tid
_id
:
mongoose
.
Types
.
ObjectId
(
tid
)
},
{
},
{
status
:
3
status
:
3
},
null
,
function
(
err
,
result
)
{
},
null
,
function
(
err
,
result
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment