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
e0ece109
Commit
e0ece109
authored
Mar 11, 2016
by
陈家荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
回复二级评论时,出现无楼层互动评论
parent
9579b9cb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
61 deletions
+12
-61
forumThread.js
app/controllers/admin/forumThread.js
+12
-61
No files found.
app/controllers/admin/forumThread.js
View file @
e0ece109
...
...
@@ -617,7 +617,6 @@ router.put('/recommend_threads/orderIDX/:id/:order', function(req, res, next) {
});
//评论列表
router
.
get
(
'/thread/:tid/comment/list'
,
function
(
req
,
res
,
next
)
{
var
tid
=
req
.
params
.
tid
||
null
;
var
pageNo
=
req
.
query
.
pageNo
||
1
;
var
pageSize
=
req
.
query
.
pageSize
||
10
;
...
...
@@ -649,11 +648,21 @@ router.get('/thread/:tid/comment/list', function(req, res, next) {
if
(
e
.
level
==
1
)
{
cb
(
null
,
e
);
}
else
{
forumCommentService
.
getCommentParent
(
e
.
_id
,
function
(
err
,
p_comment
)
{
if
(
p_comment
){
forumCommentService
.
getCommentParent
(
new
mongoose
.
Types
.
ObjectId
(
e
.
_id
)
,
function
(
err
,
p_comment
)
{
if
(
p_comment
&&
p_comment
.
floor
){
var
comment
=
e
.
toObject
();
comment
.
floor
=
p_comment
.
floor
;
cb
(
null
,
comment
);
}
else
if
(
p_comment
&&
!
p_comment
.
floor
){
//上一级没有楼层就再查上一级的评论
forumCommentService
.
getCommentParent
(
new
mongoose
.
Types
.
ObjectId
(
p_comment
.
_id
),
function
(
err
,
p_p_comment
)
{
if
(
p_comment
){
var
comment
=
e
.
toObject
();
comment
.
floor
=
p_p_comment
.
floor
;
cb
(
null
,
comment
);
}
else
{
cb
(
null
,
e
);
}
});
}
else
{
cb
(
null
,
e
);
}
...
...
@@ -921,16 +930,6 @@ router.post('/thread/comment/update/:cid/comments', function(req, res, next) {
var
tid
=
req
.
body
.
tid
||
null
;
var
cid
=
req
.
params
.
cid
||
null
;
var
replayComment_id
=
req
.
body
.
replayComment_id
;
// 获取评论的子评论列表
// 更新文章评论 + 1
// forumThreadService.updateThreadCommentCountInc(tid, function(err, thread) {
// if (err) {
// console.error(err);
// }
// });
// 更新评论对象
// result.comment_count+=1; // 回复评论+1
forumCommentService
.
updateCommentById
(
cid
,
{
$push
:
{
comments
:
replayComment_id
...
...
@@ -949,53 +948,6 @@ router.post('/thread/comment/update/:cid/comments', function(req, res, next) {
});
});
// 更新评论的子评论列表
router
.
post
(
'/thread/comment/update/:cid/comments'
,
function
(
req
,
res
,
next
)
{
var
cid
=
req
.
params
.
cid
||
null
;
var
replayComment_id
=
req
.
body
.
replayComment_id
;
forumCommentService
.
updateCommentById
(
cid
,
{
$push
:
{
comments
:
replayComment_id
}
},
function
(
err
,
result
)
{
if
(
err
)
{
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
res
.
json
(
returnCode
.
SUCCESS
);
}
});
// 获取评论的子评论列表
// forumCommentService.getCommentById(cid, function(err, result) {
// if (err) {
// console.error(err);
// res.json(returnCode.BUSY);
// } else {
// // var commentList = result.comments;
// // result.comments.push(replayComment_id);
// forumCommentService.updateCommentById(cid, {
// $push: {
// comments: replayComment_id
// }
// },
// function(err, result) {
// if (err) {
// console.error(err);
// res.json(returnCode.BUSY);
// } else {
// res.json(returnCode.SUCCESS);
// }
// });
// }
// });
});
//添加评论
router
.
post
(
'/thread/comment/add'
,
function
(
req
,
res
,
next
)
{
var
tid
=
req
.
body
.
tid
||
null
;
...
...
@@ -1043,7 +995,6 @@ router.post('/thread/comment/add', function(req, res, next) {
});
}
}
entity
.
from
=
user
;
callback
();
}
...
...
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