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
Show 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) {
var
mid
=
req
.
session
.
openUser
.
mid
,
action
=
'share_timeline'
,
ent_code
=
req
.
session
.
user
.
ent_code
;
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) {
var
mid
=
req
.
session
.
openUser
.
mid
,
action
=
'share_singlemessage'
,
ent_code
=
req
.
session
.
user
.
ent_code
;
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');
var
forumShareLogService
=
require
(
'../../service/forumShareLogService'
);
var
forumCommentService
=
require
(
'../../service/forumCommentService'
);
var
forumUserThreadControlService
=
require
(
'../../service/forumUserThreadControlService'
);
var
forumLimitActionRefService
=
require
(
'../../service/forumLimitActionRefService'
);
var
httpService
=
require
(
'../../service/httpService'
);
...
...
@@ -130,6 +131,15 @@ router.get('/thread/searchComment', function(req, res, next) {
//新增论坛文章
router
.
post
(
'/thread/create'
,
function
(
req
,
res
,
next
)
{
var
mid
=
req
.
session
.
openUser
.
mid
;
forumLimitActionRefService
.
checkLimitActionProhibitionOfSpeech
(
mid
,
function
(
err
,
isProhibition
){
if
(
err
){
console
.
error
(
err
);
res
.
json
(
returnCode
.
PROHIBITION_OF_SPEECH
);
}
else
{
if
(
isProhibition
){
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
)
{
...
...
@@ -141,7 +151,17 @@ router.post('/thread/create', function(req, res, next) {
if
(
err
)
{
res
.
json
(
returnCode
.
BUSY
);
}
else
{
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
...
...
@@ -154,6 +174,9 @@ router.post('/thread/create', 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
)
{
var
mid
=
req
.
session
.
openUser
.
mid
;
var
tid
=
req
.
params
.
tid
||
null
;
if
(
tid
)
{
var
integral
=
req
.
session
.
openUser
.
integral
||
0
;
...
...
@@ -306,7 +330,19 @@ router.post('/thread/:tid/raise', function(req, res, next) {
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
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
)
{
if
(
err
)
{
console
.
error
(
err
);
...
...
@@ -408,6 +444,15 @@ router.post('/thread/:tid/share', function(req, res, next) {
//新增文章评论
router
.
post
(
'/thread/:tid/comment/create'
,
function
(
req
,
res
,
next
)
{
var
mid
=
req
.
session
.
openUser
.
mid
;
forumLimitActionRefService
.
checkLimitActionProhibitionOfSpeech
(
mid
,
function
(
err
,
isProhibition
){
if
(
err
){
console
.
error
(
err
);
res
.
json
(
returnCode
.
PROHIBITION_OF_SPEECH
);
}
else
{
if
(
isProhibition
){
res
.
json
(
returnCode
.
PROHIBITION_OF_SPEECH
);
}
else
{
var
tid
=
req
.
params
.
tid
||
null
;
if
(
tid
)
{
var
integral
=
req
.
session
.
openUser
.
integral
||
0
;
...
...
@@ -501,7 +546,16 @@ router.post('/thread/:tid/comment/create', function(req, res, next) {
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
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条评论
...
...
@@ -554,10 +608,22 @@ router.post('/thread/:tid/comment/create', function(req, res, next) {
}
else
{
res
.
json
(
returnCode
.
WRONG_PARAM
);
}
}
}
});
});
//新建文章评论的子评论
router
.
post
(
'/thread/:tid/comment/:cid/create'
,
function
(
req
,
res
,
next
)
{
var
mid
=
req
.
session
.
openUser
.
mid
;
forumLimitActionRefService
.
checkLimitActionProhibitionOfSpeech
(
mid
,
function
(
err
,
isProhibition
){
if
(
err
){
console
.
error
(
err
);
res
.
json
(
returnCode
.
PROHIBITION_OF_SPEECH
);
}
else
{
if
(
isProhibition
){
res
.
json
(
returnCode
.
PROHIBITION_OF_SPEECH
);
}
else
{
var
tid
=
req
.
params
.
tid
||
null
;
var
cid
=
req
.
params
.
cid
||
null
;
if
(
tid
&&
cid
)
{
...
...
@@ -629,7 +695,18 @@ router.post('/thread/:tid/comment/:cid/create', function(req, res, next) {
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
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
,
'reply'
);
}
}
});
// httpService.sendRequest(req.session.user.ent_code, req.session.openUser.mid, 'reply');
ForumComment
.
populate
(
results
[
0
],
{
path
:
'from to'
,
select
:
'uid nickName icon comments'
...
...
@@ -659,6 +736,12 @@ router.post('/thread/:tid/comment/:cid/create', function(req, res, next) {
}
else
{
res
.
json
(
returnCode
.
WRONG_PARAM
);
}
}
}
});
});
//更改评论状态为3(删除)
...
...
@@ -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
)
{
var
tid
=
req
.
params
.
tid
||
null
;
var
cid
=
req
.
params
.
cid
||
null
;
var
mid
=
req
.
session
.
openUser
.
mid
;
if
(
tid
&&
cid
)
{
var
integral
=
req
.
session
.
openUser
.
integral
||
0
;
...
...
@@ -831,7 +914,18 @@ router.post('/thread/:tid/comment/:cid/raise', function(req, res, next) {
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
}
else
{
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
)
{
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