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
7ae9df80
Commit
7ae9df80
authored
Mar 11, 2016
by
陈家荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新评论
parent
b297a896
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
2 deletions
+25
-2
forumThread.js
app/controllers/admin/forumThread.js
+18
-2
forumCommentService.js
app/service/forumCommentService.js
+7
-0
No files found.
app/controllers/admin/forumThread.js
View file @
7ae9df80
...
...
@@ -923,8 +923,17 @@ router.post('/thread/comment/update/:cid', function(req, res, next) {
router
.
post
(
'/thread/comment/update/:cid/comments'
,
function
(
req
,
res
,
next
)
{
var
tid
=
req
.
body
.
tid
||
null
;
var
cid
=
req
.
params
.
cid
||
null
;
var
floor
=
req
.
body
.
floor
||
null
;
var
replayComment_id
=
req
.
body
.
replayComment_id
;
forumCommentService
.
updateCommentById
(
cid
,
{
var
ent_code
=
req
.
session
.
user
.
ent_code
;
var
conditions
=
{
"thread"
:
tid
,
"level"
:
"1"
,
"floor"
:
floor
,
"ent_code"
:
ent_code
};
forumCommentService
.
updateComment
(
conditions
,
{
$push
:
{
comments
:
replayComment_id
},
...
...
@@ -1013,7 +1022,7 @@ router.post('/thread/comment/add', function(req, res, next) {
forumCommentService
.
createComment
(
entity
,
function
(
err
,
comment
)
{
if
(
err
)
{
callback
(
err
);
}
else
{
}
else
if
(
entity
.
level
==
1
)
{
forumThreadService
.
getById
(
tid
,
function
(
err
,
thread
)
{
if
(
entity
.
level
==
1
)
{
forumAboutMEService
.
saveCommentLevel1
(
thread
,
comment
);
...
...
@@ -1038,6 +1047,13 @@ router.post('/thread/comment/add', function(req, res, next) {
callback
(
null
,
returnData
);
});
});
}
else
{
var
returnData
=
{
comment
:
comment
,
errorcode
:
0
,
errormsg
:
'请求成功'
}
callback
(
null
,
returnData
);
}
});
}
...
...
app/service/forumCommentService.js
View file @
7ae9df80
...
...
@@ -88,6 +88,13 @@ exports.updateCommentById = function(cid, entity, callback) {
});
};
//根据条件更新评论 entity
exports
.
updateComment
=
function
(
conditions
,
entity
,
callback
)
{
ForumComment
.
findOneAndUpdate
(
conditions
,
entity
,
function
(
err
,
doc
)
{
callback
(
err
,
doc
);
});
};
//根据ID删除评论
exports
.
deleteCommentById
=
function
(
cid
,
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