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
857b0774
Commit
857b0774
authored
Aug 04, 2015
by
陈家荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新了查询文章的方法
parent
c8a81d87
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
14 deletions
+55
-14
forumThread.js
app/controllers/admin/forumThread.js
+55
-14
No files found.
app/controllers/admin/forumThread.js
View file @
857b0774
...
...
@@ -106,6 +106,7 @@ router.post('/thread/create', function(req, res, next) {
//获取目标论坛文章
router
.
get
(
'/thread/:tid/get'
,
function
(
req
,
res
,
next
)
{
var
uid
=
req
.
session
.
user
.
id
;
var
tid
=
req
.
params
.
tid
||
null
;
var
rs
=
{};
if
(
tid
)
{
...
...
@@ -132,22 +133,37 @@ router.get('/thread/:tid/get', function(req, res, next) {
callback
(
null
,[
thread
]);
}
},
function
(
thread
,
callback
)
{
forumUserService
.
getUserByUid
(
uid
,
function
(
err
,
results
)
{
if
(
err
)
{
callback
(
err
,
null
);
}
else
{
callback
(
null
,
results
);
}
});
}
],
function
(
err
,
results
)
{
if
(
err
)
{
res
.
json
(
returnCode
.
BUSY
);
}
else
{
var
isSameAuthor
=
false
;
if
(
results
[
0
]
&&
results
[
2
]
&&
results
[
0
].
from
&&
results
[
0
].
from
.
_id
.
toString
()
===
results
[
2
].
_id
.
toString
()){
isSameAuthor
=
true
;
}
if
(
results
[
0
].
pid
)
{
forumThreadService
.
getById
(
results
[
0
].
pid
,
function
(
err
,
parentThread
)
{
rs
.
data
=
results
[
0
];
rs
.
tagList
=
results
[
1
];
rs
.
parentThread
=
parentThread
;
rs
.
isSameAuthor
=
isSameAuthor
;
res
.
json
(
_
.
assign
(
rs
,
returnCode
.
SUCCESS
));
});
}
else
{
rs
.
data
=
results
[
0
];
rs
.
tagList
=
results
[
1
];
rs
.
isSameAuthor
=
isSameAuthor
;
res
.
json
(
_
.
assign
(
rs
,
returnCode
.
SUCCESS
));
}
...
...
@@ -294,6 +310,8 @@ router.get('/threads/list', function(req, res, next) {
var
content
=
req
.
query
.
content
;
var
type
=
req
.
query
.
type
;
var
status
=
req
.
query
.
status
;
var
nickName
=
req
.
query
.
nickName
;
var
conditions
=
{
ent_code
:
req
.
session
.
user
.
ent_code
,
level
:
1
,
...
...
@@ -326,23 +344,46 @@ router.get('/threads/list', function(req, res, next) {
if
(
status
){
conditions
.
status
=
status
;
}
forumThreadService
.
getAllThreadByFid
(
conditions
,
pageNo
,
pageSize
,
null
,
function
(
err
,
results
)
{
if
(
err
)
{
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
if
(
pid
)
{
forumThreadService
.
getById
(
pid
,
function
(
err
,
parentThread
)
{
res
.
json
(
_
.
assign
({
parentThread
:
parentThread
},
results
,
returnCode
.
SUCCESS
));
});
if
(
nickName
){
forumThreadService
.
getAllThreadByFidAndNickName
(
nickName
,
conditions
,
pageNo
,
pageSize
,
null
,
function
(
err
,
results
)
{
if
(
err
)
{
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
res
.
json
(
_
.
assign
(
results
,
returnCode
.
SUCCESS
));
if
(
pid
)
{
forumThreadService
.
getById
(
pid
,
function
(
err
,
parentThread
)
{
res
.
json
(
_
.
assign
({
parentThread
:
parentThread
},
results
,
returnCode
.
SUCCESS
));
});
}
else
{
res
.
json
(
_
.
assign
(
results
,
returnCode
.
SUCCESS
));
}
}
}
});
});
}
else
{
forumThreadService
.
getAllThreadByFid
(
conditions
,
pageNo
,
pageSize
,
null
,
function
(
err
,
results
)
{
if
(
err
)
{
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
if
(
pid
)
{
forumThreadService
.
getById
(
pid
,
function
(
err
,
parentThread
)
{
res
.
json
(
_
.
assign
({
parentThread
:
parentThread
},
results
,
returnCode
.
SUCCESS
));
});
}
else
{
res
.
json
(
_
.
assign
(
results
,
returnCode
.
SUCCESS
));
}
}
});
}
});
...
...
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