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
e45b377b
Commit
e45b377b
authored
Jul 23, 2015
by
陈家荣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
b50a286f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
368 additions
and
248 deletions
+368
-248
forumShare.js
app/controllers/mobile/forumShare.js
+32
-6
forumThread.js
app/controllers/mobile/forumThread.js
+336
-242
No files found.
app/controllers/mobile/forumShare.js
View file @
e45b377b
...
@@ -216,9 +216,22 @@ router.get('/:ent_code/share/timeline', function(req, res, next) {
...
@@ -216,9 +216,22 @@ router.get('/:ent_code/share/timeline', function(req, res, next) {
var
mid
=
req
.
session
.
openUser
.
mid
,
var
mid
=
req
.
session
.
openUser
.
mid
,
action
=
'share_timeline'
,
action
=
'share_timeline'
,
ent_code
=
req
.
session
.
user
.
ent_code
;
ent_code
=
req
.
session
.
user
.
ent_code
;
httpService
.
createShareLog
(
req
,
1
);
httpService
.
sendRequest
(
ent_code
,
mid
,
action
);
res
.
status
(
200
).
end
();
forumLimitActionRefService
.
checkLimitActionProhibitionAddIntegral
(
mid
,
function
(
err
,
flag
){
if
(
err
){
console
.
error
(
err
);
res
.
json
(
returnCode
.
PROHIBITION_OF_SPEECH
);
}
else
{
if
(
flag
){
res
.
json
(
returnCode
.
PROHIBITION_OF_SPEECH
);
}
else
{
httpService
.
createShareLog
(
req
,
1
);
httpService
.
sendRequest
(
ent_code
,
mid
,
action
);
res
.
status
(
200
).
end
();
}
}
});
});
});
//微信分享单人接口
//微信分享单人接口
...
@@ -226,7 +239,20 @@ router.get('/:ent_code/share/singlemessage', function(req, res, next) {
...
@@ -226,7 +239,20 @@ router.get('/:ent_code/share/singlemessage', function(req, res, next) {
var
mid
=
req
.
session
.
openUser
.
mid
,
var
mid
=
req
.
session
.
openUser
.
mid
,
action
=
'share_singlemessage'
,
action
=
'share_singlemessage'
,
ent_code
=
req
.
session
.
user
.
ent_code
;
ent_code
=
req
.
session
.
user
.
ent_code
;
httpService
.
createShareLog
(
req
,
2
);
httpService
.
sendRequest
(
ent_code
,
mid
,
action
);
res
.
status
(
200
).
end
();
forumLimitActionRefService
.
checkLimitActionProhibitionAddIntegral
(
mid
,
function
(
err
,
flag
){
if
(
err
){
console
.
error
(
err
);
res
.
json
(
returnCode
.
PROHIBITION_OF_SPEECH
);
}
else
{
if
(
flag
){
res
.
json
(
returnCode
.
PROHIBITION_OF_SPEECH
);
}
else
{
httpService
.
createShareLog
(
req
,
2
);
httpService
.
sendRequest
(
ent_code
,
mid
,
action
);
res
.
status
(
200
).
end
();
}
}
});
});
});
app/controllers/mobile/forumThread.js
View file @
e45b377b
...
@@ -13,6 +13,7 @@ var forumPraiseLogService = require('../../service/forumPraiseLogService');
...
@@ -13,6 +13,7 @@ var forumPraiseLogService = require('../../service/forumPraiseLogService');
var
forumShareLogService
=
require
(
'../../service/forumShareLogService'
);
var
forumShareLogService
=
require
(
'../../service/forumShareLogService'
);
var
forumCommentService
=
require
(
'../../service/forumCommentService'
);
var
forumCommentService
=
require
(
'../../service/forumCommentService'
);
var
forumUserThreadControlService
=
require
(
'../../service/forumUserThreadControlService'
);
var
forumUserThreadControlService
=
require
(
'../../service/forumUserThreadControlService'
);
var
forumLimitActionRefService
=
require
(
'../../service/forumLimitActionRefService'
);
var
httpService
=
require
(
'../../service/httpService'
);
var
httpService
=
require
(
'../../service/httpService'
);
...
@@ -130,27 +131,49 @@ router.get('/thread/searchComment', function(req, res, next) {
...
@@ -130,27 +131,49 @@ router.get('/thread/searchComment', function(req, res, next) {
//新增论坛文章
//新增论坛文章
router
.
post
(
'/thread/create'
,
function
(
req
,
res
,
next
)
{
router
.
post
(
'/thread/create'
,
function
(
req
,
res
,
next
)
{
var
integral
=
req
.
session
.
openUser
.
integral
||
0
;
var
mid
=
req
.
session
.
openUser
.
mid
;
var
exp
=
req
.
session
.
openUser
.
exp
||
0
;
forumLimitActionRefService
.
checkLimitActionProhibitionOfSpeech
(
mid
,
function
(
err
,
isProhibition
){
forumRolePermissionService
.
checkRolePermiss
(
req
.
session
.
user
.
ent_code
,
'create'
,
integral
,
exp
,
function
(
err
,
result
)
{
if
(
err
){
if
(
err
)
{
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
res
.
json
(
returnCode
.
PROHIBITION_OF_SPEECH
);
}
else
{
}
else
{
if
(
result
)
{
//有操作权限
if
(
isProhibition
){
create
(
req
,
function
(
err
,
thread
)
{
res
.
json
(
returnCode
.
PROHIBITION_OF_SPEECH
);
}
else
{
var
integral
=
req
.
session
.
openUser
.
integral
||
0
;
var
exp
=
req
.
session
.
openUser
.
exp
||
0
;
forumRolePermissionService
.
checkRolePermiss
(
req
.
session
.
user
.
ent_code
,
'create'
,
integral
,
exp
,
function
(
err
,
result
)
{
if
(
err
)
{
if
(
err
)
{
res
.
json
(
returnCode
.
BUSY
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
}
else
{
httpService
.
sendRequest
(
req
.
session
.
user
.
ent_code
,
req
.
session
.
openUser
.
mid
,
'post'
);
if
(
result
)
{
//有操作权限
var
rs
=
{};
create
(
req
,
function
(
err
,
thread
)
{
rs
.
data
=
{
if
(
err
)
{
'id'
:
thread
.
_id
res
.
json
(
returnCode
.
BUSY
);
};
}
else
{
res
.
json
(
_
.
assign
(
rs
,
returnCode
.
SUCCESS
));
forumLimitActionRefService
.
checkLimitActionProhibitionAddIntegral
(
mid
,
function
(
err
,
flag
){
if
(
err
){
console
.
error
(
err
);
}
else
{
if
(
!
flag
){
httpService
.
sendRequest
(
req
.
session
.
user
.
ent_code
,
req
.
session
.
openUser
.
mid
,
'post'
);
}
}
});
// httpService.sendRequest(req.session.user.ent_code, req.session.openUser.mid, 'post');
var
rs
=
{};
rs
.
data
=
{
'id'
:
thread
.
_id
};
res
.
json
(
_
.
assign
(
rs
,
returnCode
.
SUCCESS
));
}
});
}
else
{
res
.
json
(
returnCode
.
ACTION_NOT_PERMISSION
);
}
}
}
});
});
}
else
{
res
.
json
(
returnCode
.
ACTION_NOT_PERMISSION
);
}
}
}
}
});
});
...
@@ -244,6 +267,7 @@ router.post('/thread/:tid/delete', function(req, res, next) {
...
@@ -244,6 +267,7 @@ router.post('/thread/:tid/delete', function(req, res, next) {
//文章点赞
//文章点赞
router
.
post
(
'/thread/:tid/raise'
,
function
(
req
,
res
,
next
)
{
router
.
post
(
'/thread/:tid/raise'
,
function
(
req
,
res
,
next
)
{
var
mid
=
req
.
session
.
openUser
.
mid
;
var
tid
=
req
.
params
.
tid
||
null
;
var
tid
=
req
.
params
.
tid
||
null
;
if
(
tid
)
{
if
(
tid
)
{
var
integral
=
req
.
session
.
openUser
.
integral
||
0
;
var
integral
=
req
.
session
.
openUser
.
integral
||
0
;
...
@@ -306,7 +330,19 @@ router.post('/thread/:tid/raise', function(req, res, next) {
...
@@ -306,7 +330,19 @@ router.post('/thread/:tid/raise', function(req, res, next) {
console
.
error
(
err
);
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
}
else
{
httpService
.
sendRequest
(
req
.
session
.
user
.
ent_code
,
req
.
session
.
openUser
.
mid
,
'thread_praise'
);
forumLimitActionRefService
.
checkLimitActionProhibitionAddIntegral
(
mid
,
function
(
err
,
flag
){
if
(
err
){
console
.
error
(
err
);
}
else
{
if
(
!
flag
){
httpService
.
sendRequest
(
req
.
session
.
user
.
ent_code
,
req
.
session
.
openUser
.
mid
,
'thread_praise'
);
}
}
});
forumThreadService
.
getThreadById
(
tid
,
function
(
err
,
doc
)
{
forumThreadService
.
getThreadById
(
tid
,
function
(
err
,
doc
)
{
if
(
err
)
{
if
(
err
)
{
console
.
error
(
err
);
console
.
error
(
err
);
...
@@ -408,257 +444,304 @@ router.post('/thread/:tid/share', function(req, res, next) {
...
@@ -408,257 +444,304 @@ router.post('/thread/:tid/share', function(req, res, next) {
//新增文章评论
//新增文章评论
router
.
post
(
'/thread/:tid/comment/create'
,
function
(
req
,
res
,
next
)
{
router
.
post
(
'/thread/:tid/comment/create'
,
function
(
req
,
res
,
next
)
{
var
tid
=
req
.
params
.
tid
||
null
;
var
mid
=
req
.
session
.
openUser
.
mid
;
if
(
tid
)
{
forumLimitActionRefService
.
checkLimitActionProhibitionOfSpeech
(
mid
,
function
(
err
,
isProhibition
){
var
integral
=
req
.
session
.
openUser
.
integral
||
0
;
if
(
err
){
var
exp
=
req
.
session
.
openUser
.
exp
||
0
;
console
.
error
(
err
);
var
destination
=
req
.
body
.
destination
||
'1'
;
res
.
json
(
returnCode
.
PROHIBITION_OF_SPEECH
);
//1.检查是否有权限
}
else
{
forumRolePermissionService
.
checkRolePermiss
(
req
.
session
.
user
.
ent_code
,
'comment'
,
integral
,
exp
,
function
(
err
,
result
)
{
if
(
isProhibition
){
if
(
err
)
{
res
.
json
(
returnCode
.
PROHIBITION_OF_SPEECH
);
console
.
error
(
err
);
}
else
{
res
.
json
(
returnCode
.
BUSY
);
var
tid
=
req
.
params
.
tid
||
null
;
}
else
{
if
(
tid
)
{
if
(
result
)
{
//有操作权限
var
integral
=
req
.
session
.
openUser
.
integral
||
0
;
var
content
=
req
.
body
.
content
;
var
exp
=
req
.
session
.
openUser
.
exp
||
0
;
if
(
content
)
{
//评论不能为空
var
destination
=
req
.
body
.
destination
||
'1'
;
//2.获取论坛文章
//1.检查是否有权限
forumThreadService
.
getThreadById
(
tid
,
function
(
err
,
thread
)
{
forumRolePermissionService
.
checkRolePermiss
(
req
.
session
.
user
.
ent_code
,
'comment'
,
integral
,
exp
,
function
(
err
,
result
)
{
if
(
err
)
{
if
(
err
)
{
res
.
json
(
returnCode
.
BUSY
);
console
.
error
(
err
);
}
else
{
res
.
json
(
returnCode
.
BUSY
);
async
.
parallel
([
}
else
{
function
(
callback
)
{
if
(
result
)
{
//有操作权限
var
floor
=
1
;
var
content
=
req
.
body
.
content
;
var
entity
=
{
if
(
content
)
{
//评论不能为空
ent_code
:
req
.
session
.
user
.
ent_code
,
//2.获取论坛文章
from
:
user
.
getMobileUser
(
req
),
forumThreadService
.
getThreadById
(
tid
,
function
(
err
,
thread
)
{
content
:
content
,
if
(
err
)
{
ip
:
req
.
ip
,
res
.
json
(
returnCode
.
BUSY
);
thread
:
thread
,
}
else
{
level
:
'1'
,
async
.
parallel
([
floor
:
floor
function
(
callback
)
{
};
var
floor
=
1
;
var
entity
=
{
var
conditions
=
{
ent_code
:
req
.
session
.
user
.
ent_code
,
thread
:
thread
.
_id
,
from
:
user
.
getMobileUser
(
req
),
level
:
'1'
content
:
content
,
};
ip
:
req
.
ip
,
forumCommentService
.
count
(
conditions
,
function
(
err
,
count
)
{
thread
:
thread
,
if
(
err
)
{
level
:
'1'
,
console
.
log
(
err
);
floor
:
floor
callback
(
err
,
null
);
};
}
else
{
// callback(null, count);
var
conditions
=
{
if
(
count
){
thread
:
thread
.
_id
,
entity
.
floor
=
count
+
1
;
level
:
'1'
}
};
//4.创建文章评论
forumCommentService
.
count
(
conditions
,
function
(
err
,
count
)
{
forumCommentService
.
createComment
(
entity
,
function
(
err
,
newComment
)
{
if
(
err
)
{
if
(
err
)
{
console
.
log
(
err
);
callback
(
err
,
null
);
callback
(
err
,
null
);
}
else
{
}
else
{
var
comments
=
thread
.
comments
;
// callback(null, count);
// console.log('=========');
if
(
count
){
// console.log(comments);
entity
.
floor
=
count
+
1
;
// console.log('=========');
}
var
array
=
[];
//4.创建文章评论
if
(
comments
&&
comments
.
items
&&
comments
.
items
.
length
>
0
)
{
forumCommentService
.
createComment
(
entity
,
function
(
err
,
newComment
)
{
array
=
comments
.
items
;
if
(
err
)
{
callback
(
err
,
null
);
}
else
{
var
comments
=
thread
.
comments
;
// console.log('=========');
// console.log(comments);
// console.log('=========');
var
array
=
[];
if
(
comments
&&
comments
.
items
&&
comments
.
items
.
length
>
0
)
{
array
=
comments
.
items
;
}
array
.
push
(
newComment
.
_id
);
forumThreadService
.
updateThreadById
(
tid
,
{
comments
:
array
},
function
(
err
,
result
)
{
if
(
err
)
{
callback
(
err
,
null
);
}
else
{
callback
(
null
,
null
);
}
});
}
});
}
}
array
.
push
(
newComment
.
_id
);
});
forumThreadService
.
updateThreadById
(
tid
,
{
},
comments
:
array
function
(
callback
)
{
},
function
(
err
,
result
)
{
//3.更新文章统计数据(评论数)
if
(
thread
)
{
forumThreadService
.
updateThreadCommentCountInc
(
tid
,
function
(
err
,
results
)
{
if
(
err
)
{
if
(
err
)
{
console
.
log
(
err
);
callback
(
err
,
null
);
callback
(
err
,
null
);
}
else
{
}
else
{
callback
(
null
,
null
);
callback
(
null
,
null
);
}
}
});
});
}
else
{
callback
(
'cannot find thread by id'
,
null
);
}
}
});
}
}
],
function
(
err
,
results
)
{
});
},
function
(
callback
)
{
//3.更新文章统计数据(评论数)
if
(
thread
)
{
forumThreadService
.
updateThreadCommentCountInc
(
tid
,
function
(
err
,
results
)
{
if
(
err
)
{
if
(
err
)
{
console
.
log
(
err
);
console
.
error
(
err
);
callback
(
err
,
null
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
}
else
{
callback
(
null
,
null
);
forumLimitActionRefService
.
checkLimitActionProhibitionAddIntegral
(
mid
,
function
(
err
,
flag
){
if
(
err
){
console
.
error
(
err
);
}
else
{
if
(
!
flag
){
httpService
.
sendRequest
(
req
.
session
.
user
.
ent_code
,
req
.
session
.
openUser
.
mid
,
'comment'
);
}
}
});
async
.
parallel
([
function
(
callback
)
{
//获取最新5条评论
var
conditions
=
{
thread
:
tid
,
level
:
'1'
};
forumCommentService
.
getAllComment
(
conditions
,
1
,
5
,
function
(
err
,
results
)
{
if
(
err
)
{
console
.
log
(
err
);
callback
(
err
,
null
);
}
else
{
callback
(
null
,
results
);
}
});
},
function
(
callback
)
{
forumThreadService
.
getThreadById
(
tid
,
function
(
err
,
thread
)
{
if
(
err
)
{
console
.
log
(
err
);
callback
(
err
,
null
);
}
else
{
callback
(
null
,
thread
);
}
});
}
],
function
(
err
,
results
)
{
if
(
err
)
{
res
.
json
(
returnCode
.
BUSY
);
}
else
{
var
rs
=
{};
rs
.
comments
=
results
[
0
].
items
;
rs
.
commentCount
=
results
[
1
].
comment_count
;
res
.
json
(
_
.
assign
(
rs
,
returnCode
.
SUCCESS
));
}
});
}
}
});
});
}
else
{
callback
(
'cannot find thread by id'
,
null
);
}
}
}
});
],
function
(
err
,
results
)
{
}
else
{
if
(
err
)
{
res
.
json
(
returnCode
.
WRONG_PARAM
);
console
.
error
(
err
);
}
res
.
json
(
returnCode
.
BUSY
);
}
else
{
}
else
{
res
.
json
(
returnCode
.
ACTION_NOT_PERMISSION
);
httpService
.
sendRequest
(
req
.
session
.
user
.
ent_code
,
req
.
session
.
openUser
.
mid
,
'comment'
);
async
.
parallel
([
function
(
callback
)
{
//获取最新5条评论
var
conditions
=
{
thread
:
tid
,
level
:
'1'
};
forumCommentService
.
getAllComment
(
conditions
,
1
,
5
,
function
(
err
,
results
)
{
if
(
err
)
{
console
.
log
(
err
);
callback
(
err
,
null
);
}
else
{
callback
(
null
,
results
);
}
});
},
function
(
callback
)
{
forumThreadService
.
getThreadById
(
tid
,
function
(
err
,
thread
)
{
if
(
err
)
{
console
.
log
(
err
);
callback
(
err
,
null
);
}
else
{
callback
(
null
,
thread
);
}
});
}
],
function
(
err
,
results
)
{
if
(
err
)
{
res
.
json
(
returnCode
.
BUSY
);
}
else
{
var
rs
=
{};
rs
.
comments
=
results
[
0
].
items
;
rs
.
commentCount
=
results
[
1
].
comment_count
;
res
.
json
(
_
.
assign
(
rs
,
returnCode
.
SUCCESS
));
}
});
}
});
}
}
});
}
}
else
{
});
res
.
json
(
returnCode
.
WRONG_PARAM
);
}
}
else
{
}
else
{
res
.
json
(
returnCode
.
ACTION_NOT_PERMISSION
);
res
.
json
(
returnCode
.
WRONG_PARAM
);
}
}
}
}
});
}
}
else
{
});
res
.
json
(
returnCode
.
WRONG_PARAM
);
}
});
});
//新建文章评论的子评论
//新建文章评论的子评论
router
.
post
(
'/thread/:tid/comment/:cid/create'
,
function
(
req
,
res
,
next
)
{
router
.
post
(
'/thread/:tid/comment/:cid/create'
,
function
(
req
,
res
,
next
)
{
var
tid
=
req
.
params
.
tid
||
null
;
var
mid
=
req
.
session
.
openUser
.
mid
;
var
cid
=
req
.
params
.
cid
||
null
;
forumLimitActionRefService
.
checkLimitActionProhibitionOfSpeech
(
mid
,
function
(
err
,
isProhibition
){
if
(
tid
&&
cid
)
{
if
(
err
){
var
integral
=
req
.
session
.
openUser
.
integral
||
0
;
console
.
error
(
err
);
var
exp
=
req
.
session
.
openUser
.
exp
||
0
;
res
.
json
(
returnCode
.
PROHIBITION_OF_SPEECH
);
var
destination
=
req
.
body
.
destination
||
'1'
;
}
else
{
req
.
body
.
from
=
user
.
getMobileUser
(
req
);
if
(
isProhibition
){
res
.
json
(
returnCode
.
PROHIBITION_OF_SPEECH
);
}
else
{
var
tid
=
req
.
params
.
tid
||
null
;
var
cid
=
req
.
params
.
cid
||
null
;
if
(
tid
&&
cid
)
{
var
integral
=
req
.
session
.
openUser
.
integral
||
0
;
var
exp
=
req
.
session
.
openUser
.
exp
||
0
;
var
destination
=
req
.
body
.
destination
||
'1'
;
req
.
body
.
from
=
user
.
getMobileUser
(
req
);
//1.检查是否有权限
//1.检查是否有权限
forumRolePermissionService
.
checkRolePermiss
(
req
.
session
.
user
.
ent_code
,
'reply'
,
integral
,
exp
,
function
(
err
,
result
)
{
forumRolePermissionService
.
checkRolePermiss
(
req
.
session
.
user
.
ent_code
,
'reply'
,
integral
,
exp
,
function
(
err
,
result
)
{
if
(
err
)
{
if
(
err
)
{
console
.
error
(
err
);
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
}
else
{
if
(
result
)
{
//有操作权限
if
(
result
)
{
//有操作权限
var
content
=
req
.
body
.
content
;
var
content
=
req
.
body
.
content
;
if
(
content
)
{
//评论不能为空
if
(
content
)
{
//评论不能为空
//2.获取论坛评论
//2.获取论坛评论
forumCommentService
.
getCommentById
(
cid
,
function
(
err
,
comment
)
{
forumCommentService
.
getCommentById
(
cid
,
function
(
err
,
comment
)
{
if
(
err
)
{
if
(
err
)
{
res
.
json
(
returnCode
.
BUSY
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
}
else
{
async
.
parallel
([
async
.
parallel
([
function
(
callback
)
{
function
(
callback
)
{
var
entity
=
{
var
entity
=
{
ent_code
:
req
.
session
.
user
.
ent_code
,
ent_code
:
req
.
session
.
user
.
ent_code
,
from
:
user
.
getMobileUser
(
req
),
from
:
user
.
getMobileUser
(
req
),
to
:
req
.
body
.
to
,
to
:
req
.
body
.
to
,
content
:
content
,
content
:
content
,
ip
:
req
.
ip
,
ip
:
req
.
ip
,
thread
:
tid
,
thread
:
tid
,
level
:
'2'
level
:
'2'
};
};
//4.创建文章评论
//4.创建文章评论
forumCommentService
.
createComment
(
entity
,
function
(
err
,
newComment
)
{
forumCommentService
.
createComment
(
entity
,
function
(
err
,
newComment
)
{
if
(
err
)
{
if
(
err
)
{
callback
(
err
,
null
);
callback
(
err
,
null
);
}
else
{
}
else
{
var
comments
=
comment
.
comments
;
var
comments
=
comment
.
comments
;
var
array
=
[];
var
array
=
[];
if
(
comments
&&
comments
.
length
>
0
)
{
if
(
comments
&&
comments
.
length
>
0
)
{
array
=
comments
;
array
=
comments
;
}
array
.
push
(
newComment
.
_id
);
forumCommentService
.
updateCommentById
(
cid
,
{
comments
:
array
},
function
(
err
,
result
)
{
if
(
err
)
{
callback
(
err
,
null
);
}
else
{
callback
(
null
,
newComment
);
}
});
}
});
},
function
(
callback
)
{
forumCommentService
.
updateCommentCount
(
cid
,
function
(
err
,
results
)
{
if
(
err
)
{
console
.
log
(
err
);
callback
(
err
,
null
);
}
else
{
callback
(
null
,
null
);
}
});
}
}
array
.
push
(
newComment
.
_id
);
],
function
(
err
,
results
)
{
forumCommentService
.
updateCommentById
(
cid
,
{
if
(
err
)
{
comments
:
array
console
.
error
(
err
);
},
function
(
err
,
result
)
{
res
.
json
(
returnCode
.
BUSY
);
if
(
err
)
{
}
else
{
callback
(
err
,
null
);
forumLimitActionRefService
.
checkLimitActionProhibitionAddIntegral
(
mid
,
function
(
err
,
flag
){
}
else
{
if
(
err
){
callback
(
null
,
newComment
);
console
.
error
(
err
);
}
}
else
{
});
if
(
!
flag
){
}
httpService
.
sendRequest
(
req
.
session
.
user
.
ent_code
,
req
.
session
.
openUser
.
mid
,
'reply'
);
});
}
},
}
function
(
callback
)
{
});
forumCommentService
.
updateCommentCount
(
cid
,
function
(
err
,
results
)
{
if
(
err
)
{
console
.
log
(
err
);
callback
(
err
,
null
);
}
else
{
callback
(
null
,
null
);
}
});
}
],
function
(
err
,
results
)
{
if
(
err
)
{
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
httpService
.
sendRequest
(
req
.
session
.
user
.
ent_code
,
req
.
session
.
openUser
.
mid
,
'reply'
);
ForumComment
.
populate
(
results
[
0
],
{
path
:
'from to'
,
select
:
'uid nickName icon comments'
},
function
(
err
,
c
)
{
if
(
err
)
{
res
.
json
(
returnCode
.
BUSY
);
}
else
{
var
rs
=
{};
rs
.
data
=
results
[
0
];
// httpService.sendRequest(req.session.user.ent_code, req.session.openUser.mid, 'reply');
res
.
json
(
_
.
assign
(
rs
,
returnCode
.
SUCCESS
));
ForumComment
.
populate
(
results
[
0
],
{
}
path
:
'from to'
,
});
select
:
'uid nickName icon comments'
// res.json(returnCode.SUCCESS);
},
function
(
err
,
c
)
{
}
if
(
err
)
{
});
res
.
json
(
returnCode
.
BUSY
);
}
else
{
var
rs
=
{};
rs
.
data
=
results
[
0
];
res
.
json
(
_
.
assign
(
rs
,
returnCode
.
SUCCESS
));
}
});
// res.json(returnCode.SUCCESS);
}
});
}
});
}
else
{
res
.
json
(
returnCode
.
WRONG_PARAM
);
}
}
else
{
res
.
json
(
returnCode
.
ACTION_NOT_PERMISSION
);
}
}
});
}
}
else
{
});
res
.
json
(
returnCode
.
WRONG_PARAM
);
}
}
else
{
}
else
{
res
.
json
(
returnCode
.
ACTION_NOT_PERMISSION
);
res
.
json
(
returnCode
.
WRONG_PARAM
);
}
}
}
}
});
}
}
else
{
});
res
.
json
(
returnCode
.
WRONG_PARAM
);
}
});
});
//更改评论状态为3(删除)
//更改评论状态为3(删除)
...
@@ -773,7 +856,7 @@ router.get('/thread/:tid/comment/list', function(req, res, next) {
...
@@ -773,7 +856,7 @@ router.get('/thread/:tid/comment/list', function(req, res, next) {
router
.
post
(
'/thread/:tid/comment/:cid/raise'
,
function
(
req
,
res
,
next
)
{
router
.
post
(
'/thread/:tid/comment/:cid/raise'
,
function
(
req
,
res
,
next
)
{
var
tid
=
req
.
params
.
tid
||
null
;
var
tid
=
req
.
params
.
tid
||
null
;
var
cid
=
req
.
params
.
cid
||
null
;
var
cid
=
req
.
params
.
cid
||
null
;
var
mid
=
req
.
session
.
openUser
.
mid
;
if
(
tid
&&
cid
)
{
if
(
tid
&&
cid
)
{
var
integral
=
req
.
session
.
openUser
.
integral
||
0
;
var
integral
=
req
.
session
.
openUser
.
integral
||
0
;
...
@@ -831,7 +914,18 @@ router.post('/thread/:tid/comment/:cid/raise', function(req, res, next) {
...
@@ -831,7 +914,18 @@ router.post('/thread/:tid/comment/:cid/raise', function(req, res, next) {
console
.
error
(
err
);
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
}
else
{
httpService
.
sendRequest
(
req
.
session
.
user
.
ent_code
,
req
.
session
.
openUser
.
mid
,
'comment_praise'
);
forumLimitActionRefService
.
checkLimitActionProhibitionAddIntegral
(
mid
,
function
(
err
,
flag
){
if
(
err
){
console
.
error
(
err
);
}
else
{
if
(
!
flag
){
httpService
.
sendRequest
(
req
.
session
.
user
.
ent_code
,
req
.
session
.
openUser
.
mid
,
'comment_praise'
);
}
}
});
//返回点赞总数
//返回点赞总数
forumCommentService
.
getCommentById
(
cid
,
function
(
err
,
doc
)
{
forumCommentService
.
getCommentById
(
cid
,
function
(
err
,
doc
)
{
if
(
err
)
{
if
(
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