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
1ac44206
Commit
1ac44206
authored
Apr 24, 2015
by
邓军
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
454540ef
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
9 deletions
+39
-9
forumThread.js
app/controllers/admin/forumThread.js
+39
-9
No files found.
app/controllers/admin/forumThread.js
View file @
1ac44206
...
...
@@ -30,7 +30,9 @@ router.post('/thread/create', function(req, res, next) {
var
rs
=
{};
req
.
body
.
ent_code
=
req
.
session
.
user
.
ent_code
;
if
(
!
req
.
body
.
share
){
delete
req
.
body
.
share
;
}
var
uid
=
req
.
session
.
user
.
id
;
// var uid='12345';
if
(
req
.
body
.
pid
)
{
...
...
@@ -81,7 +83,9 @@ router.post('/thread/create', function(req, res, next) {
}
});
}
});
}
}
});
}
}
});
});
...
...
@@ -113,9 +117,20 @@ router.get('/thread/:tid/get', function(req, res, next) {
if
(
err
)
{
res
.
json
(
returnCode
.
BUSY
);
}
else
{
rs
.
data
=
results
[
0
];
rs
.
tagList
=
results
[
1
];
res
.
json
(
_
.
assign
(
rs
,
returnCode
.
SUCCESS
));
if
(
results
[
0
].
pid
)
{
forumThreadService
.
getById
(
results
[
0
].
pid
,
function
(
err
,
parentThread
)
{
rs
.
data
=
results
[
0
];
rs
.
tagList
=
results
[
1
];
rs
.
parentThread
=
parentThread
;
res
.
json
(
_
.
assign
(
rs
,
returnCode
.
SUCCESS
));
});
}
else
{
rs
.
data
=
results
[
0
];
rs
.
tagList
=
results
[
1
];
res
.
json
(
_
.
assign
(
rs
,
returnCode
.
SUCCESS
));
}
}
});
}
else
{
...
...
@@ -229,7 +244,7 @@ router.get('/threads/list', function(req, res, next) {
conditions
.
level
=
2
;
}
if
(
content
)
{
if
(
content
)
{
conditions
.
content
=
{
$regex
:
content
,
$options
:
'i'
...
...
@@ -241,7 +256,15 @@ router.get('/threads/list', function(req, res, next) {
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
res
.
json
(
_
.
assign
(
results
,
returnCode
.
SUCCESS
));
if
(
results
.
items
[
0
].
pid
)
{
forumThreadService
.
getById
(
results
.
items
[
0
].
pid
,
function
(
err
,
parentThread
)
{
res
.
json
(
_
.
assign
({
parentThread
:
parentThread
},
results
,
returnCode
.
SUCCESS
));
});
}
else
{
res
.
json
(
_
.
assign
(
results
,
returnCode
.
SUCCESS
));
}
}
});
});
...
...
@@ -372,7 +395,14 @@ router.post('/thread/comment/update/:cid/comments', function(req, res, next) {
});
// 更新评论对象
// result.comment_count+=1; // 回复评论+1
forumCommentService
.
updateCommentById
(
cid
,
{
$push
:{
comments
:
replayComment_id
},
$inc
:{
comment_count
:
1
}},
function
(
err
,
result
)
{
forumCommentService
.
updateCommentById
(
cid
,
{
$push
:
{
comments
:
replayComment_id
},
$inc
:
{
comment_count
:
1
}
},
function
(
err
,
result
)
{
if
(
err
)
{
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
...
...
@@ -480,7 +510,7 @@ router.post('/thread/comment/add', function(req, res, next) {
res
.
json
(
returnCode
.
WRONG_PARAM
);
}
// 测试环境
// entity.from = '55015675868b65a028187c49';
...
...
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