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
c76dbf7f
Commit
c76dbf7f
authored
Dec 17, 2015
by
杨翌文
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1111
parent
43704520
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
9 deletions
+4
-9
forumThreadService.js
app/service/forumThreadService.js
+4
-9
No files found.
app/service/forumThreadService.js
View file @
c76dbf7f
...
...
@@ -722,22 +722,20 @@ function getSubThreads(doc, sort, callback) {
}
function
getAllThreadByFidHelp
(
conditions
,
pageNo
,
pageSize
,
sort
,
callback
)
{
console
.
time
(
'count_cost'
);
countAllByFid
(
conditions
,
function
(
err
,
count
)
{
if
(
err
)
{
console
.
error
(
err
);
callback
(
err
,
null
);
}
else
{
console
.
timeEnd
(
'count_cost'
);
console
.
time
(
'threads_cost'
);
var
skip
=
(
pageNo
-
1
)
*
pageSize
;
var
limit
=
pageSize
;
var
limit
=
count
-
skip
>
pageSize
?
pageSize
:
(
count
-
skip
)
;
var
sortBy
=
'-topTime -tag_topTime -quality -created'
;
if
(
sort
)
{
sortBy
=
sort
;
}
ForumThread
.
find
(
conditions
,
listThreadFields
).
populate
(
'from'
,
'uid mid nickName icon'
).
populate
({
ForumThread
.
find
(
conditions
,
listThreadFields
).
populate
(
'from'
,
'uid mid nickName icon'
).
populate
(
'info'
,
'name icon pv_count'
).
populate
({
path
:
'tag'
,
select
:
'title pv_count'
}).
populate
({
path
:
'comments'
,
options
:
{
where
:{
status
:
1
},
...
...
@@ -750,13 +748,11 @@ function getAllThreadByFidHelp(conditions, pageNo, pageSize, sort, callback) {
console
.
error
(
err
);
callback
(
err
,
null
);
}
else
{
console
.
timeEnd
(
'threads_cost'
);
var
obj
=
{};
obj
.
total
=
count
;
obj
.
pageNo
=
pageNo
;
obj
.
pageSize
=
pageSize
;
obj
.
items
=
docs
;
console
.
time
(
'comments_cost'
);
if
(
docs
&&
docs
.
length
>
0
)
{
var
asyncTasks
=
[];
...
...
@@ -780,7 +776,6 @@ function getAllThreadByFidHelp(conditions, pageNo, pageSize, sort, callback) {
}
else
{
obj
.
items
=
results
;
callback
(
null
,
obj
);
console
.
timeEnd
(
'comments_cost'
);
}
});
...
...
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