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
b47a2d08
Commit
b47a2d08
authored
Apr 22, 2015
by
陈家荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ggg
parent
1981c34d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
3 deletions
+20
-3
forumCommentService.js
app/service/forumCommentService.js
+20
-3
No files found.
app/service/forumCommentService.js
View file @
b47a2d08
...
@@ -38,7 +38,6 @@ exports.updateCommentStatusById=function(cid,status,callback){
...
@@ -38,7 +38,6 @@ exports.updateCommentStatusById=function(cid,status,callback){
console
.
error
(
err
);
console
.
error
(
err
);
callback
(
err
,
null
);
callback
(
err
,
null
);
}
else
{
}
else
{
console
.
log
(
result
);
callback
(
null
,
null
);
callback
(
null
,
null
);
}
}
});
});
...
@@ -51,7 +50,6 @@ exports.updateCommentById=function(cid,entity,callback){
...
@@ -51,7 +50,6 @@ exports.updateCommentById=function(cid,entity,callback){
console
.
error
(
err
);
console
.
error
(
err
);
callback
(
err
,
null
);
callback
(
err
,
null
);
}
else
{
}
else
{
console
.
log
(
result
);
callback
(
null
,
null
);
callback
(
null
,
null
);
}
}
});
});
...
@@ -84,6 +82,7 @@ function countAll(conditions,callback) {
...
@@ -84,6 +82,7 @@ function countAll(conditions,callback) {
//获取全部列表数据
//获取全部列表数据
exports
.
getAllComment
=
function
(
conditions
,
pageNo
,
pageSize
,
callback
)
{
exports
.
getAllComment
=
function
(
conditions
,
pageNo
,
pageSize
,
callback
)
{
countAll
(
conditions
,
function
(
err
,
count
){
countAll
(
conditions
,
function
(
err
,
count
){
if
(
err
){
if
(
err
){
console
.
error
(
err
);
console
.
error
(
err
);
...
@@ -91,7 +90,7 @@ exports.getAllComment= function(conditions,pageNo,pageSize,callback) {
...
@@ -91,7 +90,7 @@ exports.getAllComment= function(conditions,pageNo,pageSize,callback) {
}
else
{
}
else
{
var
skip
=
(
pageNo
-
1
)
*
pageSize
;
var
skip
=
(
pageNo
-
1
)
*
pageSize
;
var
limit
=
count
-
skip
>
pageSize
?
pageSize
:
(
count
-
skip
);
var
limit
=
count
-
skip
>
pageSize
?
pageSize
:
(
count
-
skip
);
console
.
log
(
"count:"
+
count
);
ForumComment
.
find
(
conditions
).
populate
(
'from'
).
populate
(
'to'
).
limit
(
limit
).
skip
(
skip
).
sort
(
'-created'
).
exec
(
function
(
err
,
docs
)
{
ForumComment
.
find
(
conditions
).
populate
(
'from'
).
populate
(
'to'
).
limit
(
limit
).
skip
(
skip
).
sort
(
'-created'
).
exec
(
function
(
err
,
docs
)
{
if
(
err
)
{
if
(
err
)
{
console
.
error
(
err
);
console
.
error
(
err
);
...
@@ -199,3 +198,21 @@ exports.updateCommentCount=function(cid,callback){
...
@@ -199,3 +198,21 @@ exports.updateCommentCount=function(cid,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
;
};
\ No newline at end of file
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