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
b54fd02c
Commit
b54fd02c
authored
Dec 31, 2015
by
strong
Browse files
Options
Browse Files
Download
Plain Diff
Merge commit '
240eb72e
' into SANDBOX
parents
b3ee42cc
240eb72e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
0 deletions
+43
-0
forumThreadService.js
app/service/forumThreadService.js
+43
-0
No files found.
app/service/forumThreadService.js
View file @
b54fd02c
...
...
@@ -89,6 +89,49 @@ function handleContent(content) {
return
content
.
trim
();
}
function
findOneAndUpdate
(
id
,
entity
,
callback
)
{
ForumThread
.
findOneAndUpdate
(
id
,
entity
,
function
(
err
,
doc
)
{
callback
(
err
,
doc
);
});
};
//根据发帖者分页查询话题列表
exports
.
findThread
=
function
(
pageNo
,
pageSize
,
q
,
sort
,
callback
)
{
then
(
function
(
cont
)
{
ForumThread
.
find
(
q
).
count
(
cont
);
}).
then
(
function
(
cont
,
count
)
{
var
skip
=
(
pageNo
-
1
)
*
pageSize
;
var
limit
=
count
-
skip
>
pageSize
?
pageSize
:
(
count
-
skip
);
var
sortBy
=
'-created'
;
if
(
sort
)
{
sortBy
=
sort
;
}
ForumThread
.
find
(
q
).
populate
(
'from'
).
populate
(
'info'
).
skip
(
skip
).
limit
(
limit
).
sort
(
sortBy
).
exec
(
function
(
err
,
docs
)
{
cont
(
err
,
count
,
docs
);
});
}).
then
(
function
(
cont
,
count
,
threads
)
{
var
rsJson
=
{
pageNo
:
pageNo
,
pageSize
:
pageSize
,
total
:
count
,
items
:
threads
};
callback
(
null
,
rsJson
);
}).
fail
(
function
(
cont
,
err
)
{
console
.
error
(
err
);
var
rsJson
=
{
result
:
false
,
err
:
err
};
callback
(
err
,
rsJson
);
});
};
//根据发帖者分页查询话题列表
exports
.
findThreadByPage
=
function
(
pageNo
,
pageSize
,
q
,
callback
)
{
then
(
function
(
cont
)
{
...
...
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