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
3aa04bc0
Commit
3aa04bc0
authored
Dec 16, 2015
by
杨翌文
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交修改
parent
05a6088e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
6 deletions
+25
-6
forumThreadService.js
app/service/forumThreadService.js
+25
-6
No files found.
app/service/forumThreadService.js
View file @
3aa04bc0
...
@@ -10,7 +10,7 @@ var forumCommentService = require('./forumCommentService');
...
@@ -10,7 +10,7 @@ var forumCommentService = require('./forumCommentService');
var
async
=
require
(
'async'
);
var
async
=
require
(
'async'
);
var
then
=
require
(
'thenjs'
);
var
then
=
require
(
'thenjs'
);
var
t
hreadFields
=
{
var
listT
hreadFields
=
{
content
:
1
,
content
:
1
,
type
:
1
,
type
:
1
,
title
:
1
,
title
:
1
,
...
@@ -28,6 +28,25 @@ var threadFields = {
...
@@ -28,6 +28,25 @@ var threadFields = {
};
};
var
singleThreadFields
=
{
content
:
1
,
type
:
1
,
title
:
1
,
pid
:
1
,
from
:
1
,
created
:
1
,
recommend
:
1
,
praise_count
:
1
,
comment_count
:
1
,
images
:
1
,
level
:
1
,
top
:
1
,
address
:
1
};
var
subThreadFields
=
{
var
subThreadFields
=
{
from
:
1
from
:
1
};
};
...
@@ -192,7 +211,7 @@ exports.getThreadById = function(tid, callback) {
...
@@ -192,7 +211,7 @@ exports.getThreadById = function(tid, callback) {
var
conditions
=
{
var
conditions
=
{
_id
:
tid
_id
:
tid
};
};
ForumThread
.
findOne
(
conditions
).
populate
(
'from'
).
populate
(
'info'
).
populate
(
'share'
).
exec
(
function
(
err
,
doc
)
{
ForumThread
.
findOne
(
conditions
,
singleThreadFields
).
populate
(
'from'
).
populate
(
'info'
).
populate
(
'share'
).
exec
(
function
(
err
,
doc
)
{
if
(
err
)
{
if
(
err
)
{
console
.
error
(
err
);
console
.
error
(
err
);
callback
(
err
,
null
);
callback
(
err
,
null
);
...
@@ -326,7 +345,7 @@ exports.getThreadByIdNoLimit = function(tid, callback) {
...
@@ -326,7 +345,7 @@ exports.getThreadByIdNoLimit = function(tid, callback) {
var
conditions
=
{
var
conditions
=
{
_id
:
tid
_id
:
tid
};
};
ForumThread
.
findOne
(
conditions
).
populate
(
'from'
).
populate
(
'info'
).
populate
(
'share'
).
exec
(
function
(
err
,
doc
)
{
ForumThread
.
findOne
(
conditions
,
singleThreadFields
).
populate
(
'from'
).
populate
(
'info'
).
populate
(
'share'
).
exec
(
function
(
err
,
doc
)
{
if
(
err
)
{
if
(
err
)
{
console
.
error
(
err
);
console
.
error
(
err
);
callback
(
err
,
null
);
callback
(
err
,
null
);
...
@@ -694,7 +713,7 @@ function getAllThreadByFidHelp(conditions, pageNo, pageSize, sort, callback) {
...
@@ -694,7 +713,7 @@ function getAllThreadByFidHelp(conditions, pageNo, pageSize, sort, callback) {
if
(
sort
)
{
if
(
sort
)
{
sortBy
=
sort
;
sortBy
=
sort
;
}
}
ForumThread
.
find
(
conditions
,
t
hreadFields
).
populate
(
'from'
,
'uid mid nickName icon'
).
populate
(
'info'
,
'name icon pv_count'
).
populate
({
ForumThread
.
find
(
conditions
,
listT
hreadFields
).
populate
(
'from'
,
'uid mid nickName icon'
).
populate
(
'info'
,
'name icon pv_count'
).
populate
({
path
:
'tag'
,
select
:
'title pv_count'
path
:
'tag'
,
select
:
'title pv_count'
}).
populate
({
}).
populate
({
path
:
'comments'
,
path
:
'comments'
,
...
@@ -762,7 +781,7 @@ function getAllThreadByFidHelpNoLimit(conditions, pageNo, pageSize, sort, callba
...
@@ -762,7 +781,7 @@ function getAllThreadByFidHelpNoLimit(conditions, pageNo, pageSize, sort, callba
if
(
sort
)
{
if
(
sort
)
{
sortBy
=
sort
;
sortBy
=
sort
;
}
}
ForumThread
.
find
(
conditions
,
t
hreadFields
).
populate
(
'from'
,
'uid mid nickName icon'
).
populate
(
'info'
,
'name icon pv_count'
).
populate
({
ForumThread
.
find
(
conditions
,
listT
hreadFields
).
populate
(
'from'
,
'uid mid nickName icon'
).
populate
(
'info'
,
'name icon pv_count'
).
populate
({
path
:
'tag'
,
select
:
'title pv_count'
path
:
'tag'
,
select
:
'title pv_count'
}).
populate
({
}).
populate
({
path
:
'comments'
,
path
:
'comments'
,
...
@@ -1079,7 +1098,7 @@ function getAllThreadByFidAndUserHelp(user_ids, conditions, pageNo, pageSize, so
...
@@ -1079,7 +1098,7 @@ function getAllThreadByFidAndUserHelp(user_ids, conditions, pageNo, pageSize, so
if
(
sort
)
{
if
(
sort
)
{
sortBy
=
sort
;
sortBy
=
sort
;
}
}
ForumThread
.
find
(
conditions
,
t
hreadFields
).
populate
(
'from'
,
'uid mid nickName icon'
).
populate
(
'info'
,
'name icon pv_count'
).
populate
({
ForumThread
.
find
(
conditions
,
listT
hreadFields
).
populate
(
'from'
,
'uid mid nickName icon'
).
populate
(
'info'
,
'name icon pv_count'
).
populate
({
path
:
'tag'
,
select
:
'title pv_count'
path
:
'tag'
,
select
:
'title pv_count'
}).
populate
({
}).
populate
({
path
:
'comments'
,
path
:
'comments'
,
...
...
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