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
7b7da019
Commit
7b7da019
authored
Dec 15, 2015
by
strong
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'remould_1209_delete_common'
parents
05173138
dbcae00c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
7 deletions
+71
-7
forumThread.js
app/controllers/admin/forumThread.js
+14
-7
forumThread.js
app/controllers/mobile/forumThread.js
+57
-0
No files found.
app/controllers/admin/forumThread.js
View file @
7b7da019
...
...
@@ -461,7 +461,8 @@ router.get('/threads/list', function(req, res, next) {
}
});
}
else
{
forumThreadService
.
getAllThreadByFid
(
conditions
,
pageNo
,
pageSize
,
"-created"
,
function
(
err
,
results
)
{
var
sortBy
=
'-topTime -tag_topTime -created'
;
forumThreadService
.
getAllThreadByFid
(
conditions
,
pageNo
,
pageSize
,
sortBy
,
function
(
err
,
results
)
{
if
(
err
)
{
console
.
error
(
err
);
res
.
json
(
returnCode
.
BUSY
);
...
...
@@ -495,9 +496,9 @@ router.get('/thread/:tid/comment/list', function(req, res, next) {
ent_code
:
req
.
session
.
user
.
ent_code
,
thread
:
tid
,
// level: '1',
//
status: {
//
$ne: 2
//
} //过滤被删除的数据,status 为 2 表示删除
status
:
{
$ne
:
2
}
//过滤被删除的数据,status 为 2 表示删除
};
if
(
content
)
{
conditions
.
content
=
{
...
...
@@ -546,7 +547,10 @@ router.get('/thread/:tid/comment/list/:floor', function(req, res, next) {
ent_code
:
req
.
session
.
user
.
ent_code
,
thread
:
tid
,
level
:
'1'
,
floor
:
floor
floor
:
floor
,
status
:
{
$ne
:
2
}
//过滤被删除的数据,status 为 2 表示删除
};
if
(
tid
&&
floor
)
{
...
...
@@ -591,7 +595,10 @@ router.get('/thread/:tid/comment/list/member/:mid', function(req, res, next) {
pageSize
=
req
.
query
.
pageSize
||
10
;
var
conditions
=
{
ent_code
:
req
.
session
.
user
.
ent_code
,
thread
:
tid
thread
:
tid
,
status
:
{
$ne
:
2
}
//过滤被删除的数据,status 为 2 表示删除
};
if
(
content
)
{
conditions
.
content
=
{
...
...
@@ -720,7 +727,7 @@ router.post('/thread/comment/update/:cid', function(req, res, next) {
if
(
status
==
2
)
{
//一级评论
if
(
comment
.
level
==
1
)
{
var
commentList
=
resul
t
.
comments
;
var
commentList
=
commen
t
.
comments
;
var
comments
=
forumThreadService
.
remove
(
commentList
,
cid
);
forumThreadService
.
updateThreadById
(
comment
.
thread
,
{
comments
:
comments
,
...
...
app/controllers/mobile/forumThread.js
View file @
7b7da019
...
...
@@ -23,6 +23,7 @@ var httpService = require('../../service/httpService');
var
forumAboutMEService
=
require
(
'../../service/forumAboutMEService'
);
var
user
=
require
(
'../../utils/user'
);
var
async
=
require
(
'async'
);
var
ForumModeratorApply
=
mongoose
.
model
(
'ForumModeratorApply'
);
module
.
exports
=
function
(
app
)
{
app
.
use
(
'/v1/forum'
,
router
);
};
...
...
@@ -1709,6 +1710,62 @@ router.post('/thread/:tid/comment/:cid/disable', function(req, res, next) {
}
});
//更改评论状态为0(屏蔽)
router
.
post
(
'/thread/:tid/comment/:cid/slash'
,
function
(
req
,
res
,
next
)
{
var
tid
=
req
.
params
.
tid
,
entCode
=
req
.
session
.
user
.
ent_code
,
userid
=
user
.
getMobileUser
(
req
),
//user._id
cid
=
req
.
params
.
cid
;
var
q1
=
{};
//拼装查询条件
q1
.
ent_code
=
entCode
;
q1
.
_id
=
tid
;
q1
.
status
=
1
;
q1
.
$or
=
[{
recommend
:
0
},
{
recommend
:
null
}];
ForumThread
.
findOne
(
q1
).
populate
(
'from'
).
exec
(
function
(
err
,
t
)
{
if
(
err
||
!
t
)
{
return
res
.
json
(
returnCode
.
BUSY
);
}
if
(
!
t
.
info
){
//没有板块id直接返回
return
res
.
json
(
returnCode
.
BUSY
);
}
var
q2
=
{};
//查询当前用户是不是这篇文章的版主
q2
.
status
=
1
;
q2
.
ent_code
=
entCode
;
q2
.
forumUser
=
userid
;
q2
.
infoIds
=
{
$all
:[
t
.
info
]};
ForumModeratorApply
.
findOne
(
q2
).
populate
(
'forumUser'
).
exec
(
function
(
err
,
result
){
if
(
err
){
return
res
.
json
(
returnCode
.
BUSY
);
}
if
(
!
result
){
//不是该版主
return
res
.
json
(
returnCode
.
ACTION_NOT_PERMISSION
);
}
//
forumCommentService
.
getCommentById
(
cid
,
function
(
err
,
comment
)
{
if
(
comment
&&
userid
)
{
//屏蔽
forumCommentService
.
changeStatus
(
cid
,
0
,
function
(
err
,
update
)
{
if
(
err
)
{
res
.
json
(
returnCode
.
BUSY
);
}
else
{
if
(
comment
&&
comment
.
level
==
1
)
{
forumAboutMEService
.
updateCommentLevel1Status
(
comment
.
_id
,
0
);
}
res
.
json
(
returnCode
.
SUCCESS
);
}
});
}
else
{
res
.
json
(
returnCode
.
WRONG_PARAM
);
}
});
});
});
});
//删除文章评论
router
.
post
(
'/thread/:tid/comment/:cid/delete'
,
function
(
req
,
res
,
next
)
{
var
tid
=
req
.
params
.
tid
||
null
;
...
...
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