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
91d2a66d
Commit
91d2a66d
authored
Mar 18, 2016
by
strong
Browse files
Options
Browse Files
Download
Plain Diff
Merge commit '
1301e611
' into SANDBOX
parents
6edf6c04
1301e611
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
12 deletions
+7
-12
forumCommentService.js
app/service/forumCommentService.js
+5
-3
forumThreadService.js
app/service/forumThreadService.js
+2
-9
No files found.
app/service/forumCommentService.js
View file @
91d2a66d
...
@@ -144,8 +144,10 @@ exports.getAllComment = function(conditions, pageNo, pageSize, callback) {
...
@@ -144,8 +144,10 @@ 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
);
ForumComment
.
find
(
conditions
,
listCommentFields
).
populate
({
ForumComment
.
find
(
conditions
,
listCommentFields
).
populate
(
'from'
,
'uid mid nickName icon exp'
).
populate
(
'to'
,
'uid mid nickName icon exp'
).
limit
(
limit
).
skip
(
skip
).
sort
(
'-created'
).
exec
(
function
(
err
,
docs
)
{
path
:
'from'
,
select
:
'uid mid nickName icon exp honorTitles'
}).
populate
(
'to'
,
'uid mid nickName icon exp'
).
limit
(
limit
).
skip
(
skip
).
sort
(
'-created'
).
exec
(
function
(
err
,
docs
)
{
if
(
err
)
{
if
(
err
)
{
console
.
error
(
err
);
console
.
error
(
err
);
callback
(
err
,
null
);
callback
(
err
,
null
);
...
@@ -640,7 +642,7 @@ exports.getAllComment_allstatus = function(conditions, pageNo, pageSize, callbac
...
@@ -640,7 +642,7 @@ exports.getAllComment_allstatus = function(conditions, pageNo, pageSize, callbac
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
);
ForumComment
.
find
(
conditions
,
listCommentFields
).
populate
(
'from'
,
'uid mid nickName icon exp'
).
populate
(
'to'
,
'uid mid nickName icon exp'
).
limit
(
limit
).
skip
(
skip
).
sort
(
'-created'
).
exec
(
function
(
err
,
docs
)
{
ForumComment
.
find
(
conditions
,
listCommentFields
).
populate
(
'from'
,
'uid mid nickName icon exp
honorTitles
'
).
populate
(
'to'
,
'uid mid nickName icon exp'
).
limit
(
limit
).
skip
(
skip
).
sort
(
'-created'
).
exec
(
function
(
err
,
docs
)
{
if
(
err
)
{
if
(
err
)
{
console
.
error
(
err
);
console
.
error
(
err
);
callback
(
err
,
null
);
callback
(
err
,
null
);
...
...
app/service/forumThreadService.js
View file @
91d2a66d
...
@@ -286,13 +286,9 @@ exports.getByConditions = function(conditions, callback) {
...
@@ -286,13 +286,9 @@ exports.getByConditions = function(conditions, callback) {
}
}
//根据ID获取文章
//根据ID获取文章
exports
.
getThreadById
=
function
(
tid
,
callback
)
{
exports
.
getThreadById
=
function
(
tid
,
callback
)
{
ForumThread
.
findOne
({
_id
:
tid
}).
populate
({
ForumThread
.
findOne
({
_id
:
tid
}).
populate
({
path
:
'from'
,
path
:
'from'
,
select
:
'uid mid nickName icon exp honorTitles'
,
select
:
'uid mid nickName icon exp honorTitles'
options
:
{
populate
:
"honorTitles"
//继续查荣誉
}
}).
populate
(
'info'
,
'name icon'
).
populate
(
'share'
).
exec
(
function
(
err
,
doc
)
{
}).
populate
(
'info'
,
'name icon'
).
populate
(
'share'
).
exec
(
function
(
err
,
doc
)
{
if
(
err
)
{
if
(
err
)
{
console
.
error
(
err
);
console
.
error
(
err
);
...
@@ -1380,10 +1376,7 @@ exports.getThreadWithNotPopulateComment = function(conditions, pageNo, pageSize,
...
@@ -1380,10 +1376,7 @@ exports.getThreadWithNotPopulateComment = function(conditions, pageNo, pageSize,
}
}
ForumThread
.
find
(
conditions
).
populate
({
ForumThread
.
find
(
conditions
).
populate
({
path
:
'from'
,
path
:
'from'
,
select
:
'uid mid nickName icon honorTitles'
,
select
:
'uid mid nickName icon honorTitles'
options
:
{
populate
:
"honorTitles"
//继续查荣誉
}
}).
populate
(
'info'
,
'name icon pv_count'
).
limit
(
limit
).
skip
(
skip
).
sort
(
sortBy
).
exec
(
function
(
err
,
docs
)
{
}).
populate
(
'info'
,
'name icon pv_count'
).
limit
(
limit
).
skip
(
skip
).
sort
(
sortBy
).
exec
(
function
(
err
,
docs
)
{
if
(
err
)
{
if
(
err
)
{
console
.
error
(
err
);
console
.
error
(
err
);
...
...
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