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
d062633c
Commit
d062633c
authored
Aug 27, 2015
by
陈志良
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
3e747e2a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
14 deletions
+11
-14
forumThread.js
app/controllers/mobile/forumThread.js
+10
-12
forumThreadService.js
app/service/forumThreadService.js
+1
-2
No files found.
app/controllers/mobile/forumThread.js
View file @
d062633c
...
...
@@ -14,7 +14,7 @@ var forumShareLogService = require('../../service/forumShareLogService');
var
forumCommentService
=
require
(
'../../service/forumCommentService'
);
var
forumUserThreadControlService
=
require
(
'../../service/forumUserThreadControlService'
);
var
forumLimitActionRefService
=
require
(
'../../service/forumLimitActionRefService'
);
var
commentTips
=
require
(
'../../utils/commentTips'
);
var
httpService
=
require
(
'../../service/httpService'
);
var
user
=
require
(
'../../utils/user'
);
...
...
@@ -505,8 +505,6 @@ router.post('/thread/:tid/comment/create', function(req, res, next) {
if
(
err
)
{
callback
(
err
,
null
);
}
else
{
//
commentTips
.
incrTips
(
req
.
session
.
user
.
ent_code
,
thread
.
from
);
var
comments
=
thread
.
comments
;
// console.log('=========');
// console.log(comments);
...
...
@@ -619,7 +617,6 @@ router.post('/thread/:tid/comment/create', function(req, res, next) {
//新增文章评论
router
.
post
(
'/thread/:tid/comment/create/new'
,
function
(
req
,
res
,
next
)
{
var
userId
=
req
.
session
.
mobileForumUser
.
userId
;
var
newCommentId
=
null
;
forumLimitActionRefService
.
checkLimitActionProhibitionOfSpeech
(
userId
,
function
(
err
,
isProhibition
){
if
(
err
){
console
.
error
(
err
);
...
...
@@ -678,8 +675,10 @@ router.post('/thread/:tid/comment/create/new', function(req, res, next) {
if
(
err
)
{
callback
(
err
,
null
);
}
else
{
newCommentId
=
newComment
.
_id
;
var
comments
=
thread
.
comments
;
// console.log('=========');
// console.log(comments);
// console.log('=========');
var
array
=
[];
if
(
comments
&&
comments
.
items
&&
comments
.
items
.
length
>
0
)
{
array
=
comments
.
items
;
...
...
@@ -731,17 +730,17 @@ router.post('/thread/:tid/comment/create/new', function(req, res, next) {
async
.
parallel
([
function
(
callback
)
{
//获取
创建
评论
//获取
最新5条
评论
var
conditions
=
{
thread
:
tid
,
level
:
'1'
};
forumCommentService
.
get
PopulateCommentById
(
newCommentId
,
function
(
err
,
doc
)
{
forumCommentService
.
get
AllComment
(
conditions
,
1
,
5
,
function
(
err
,
results
)
{
if
(
err
)
{
console
.
log
(
err
);
callback
(
err
,
null
);
}
else
{
callback
(
null
,
doc
);
callback
(
null
,
results
);
}
});
},
...
...
@@ -760,9 +759,9 @@ router.post('/thread/:tid/comment/create/new', function(req, res, next) {
res
.
json
(
returnCode
.
BUSY
);
}
else
{
var
rs
=
{};
rs
.
data
=
results
[
0
]
;
var
result
=
_
.
assign
(
rs
,
returnCode
.
SUCCESS
)
;
res
.
json
(
result
);
rs
.
comments
=
results
[
0
].
items
;
rs
.
commentCount
=
results
[
1
].
comment_count
;
res
.
json
(
_
.
assign
(
rs
,
returnCode
.
SUCCESS
)
);
}
});
...
...
@@ -834,7 +833,6 @@ router.post('/thread/:tid/comment/:cid/create', function(req, res, next) {
if
(
err
)
{
callback
(
err
,
null
);
}
else
{
commentTips
.
incrTips
(
req
.
session
.
user
.
ent_code
,
req
.
body
.
to
);
var
comments
=
comment
.
comments
;
var
array
=
[];
if
(
comments
&&
comments
.
length
>
0
)
{
...
...
app/service/forumThreadService.js
View file @
d062633c
...
...
@@ -251,7 +251,6 @@ exports.getThreadById = function(tid, callback) {
}
});
};
//根据ID获取文章
exports
.
getThreadByIdNoLimit
=
function
(
tid
,
callback
)
{
async
.
parallel
([
...
...
@@ -636,7 +635,7 @@ function getAllThreadByFidHelp(conditions, pageNo, pageSize, sort, callback) {
limit
:
5
,
sort
:
'-created'
},
select
:
'from to created content'
select
:
'from to created content
level
'
}).
limit
(
limit
).
skip
(
skip
).
sort
(
sortBy
).
exec
(
function
(
err
,
docs
)
{
if
(
err
)
{
console
.
error
(
err
);
...
...
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