Commit 7f823748 authored by 刘文胜's avatar 刘文胜

帖子评论接口 过滤掉status=2的数据 并且可以指定降序还是升序

parent 572274a5
...@@ -898,16 +898,23 @@ router.get('/threadManagement/threads/:tid/comment/search', function(req, res, n ...@@ -898,16 +898,23 @@ router.get('/threadManagement/threads/:tid/comment/search', function(req, res, n
mid = req.query.mid, mid = req.query.mid,
floor_start = req.query.floor_start, floor_start = req.query.floor_start,
floor_end = req.query.floor_end, floor_end = req.query.floor_end,
content = req.query.content || '', content = req.query.content || '';
sortBy = req.query.sort; var asc = req.query.asc === 'true'?1:-1;
var sort = {}; var sort = {//默认排序
if(sortBy){ floor:asc
sort[sortBy] = -1; };
if(req.query.sort){//指定排序字段
sort = {};
sort[req.query.sort] = asc;
} }
var conditions = { var conditions = {
ent_code: req.session.user.ent_code, ent_code: req.session.user.ent_code,
thread: tid, thread: tid,
level:1 level:1,
status:{
$ne:2
}
}; };
if (content) { if (content) {
conditions.content = { conditions.content = {
...@@ -960,7 +967,10 @@ router.post('/threadManagement/threads/:tid/comment/search/deleteAll', function( ...@@ -960,7 +967,10 @@ router.post('/threadManagement/threads/:tid/comment/search/deleteAll', function(
var conditions = { var conditions = {
ent_code: ent_code, ent_code: ent_code,
thread: tid, thread: tid,
level:1 level:1,
status:{
$ne:2
}
}; };
if (content) { if (content) {
conditions.content = { conditions.content = {
...@@ -1050,7 +1060,10 @@ router.post('/threadManagement/threads/:tid/comment/search/closeAll', function(r ...@@ -1050,7 +1060,10 @@ router.post('/threadManagement/threads/:tid/comment/search/closeAll', function(r
var conditions = { var conditions = {
ent_code: ent_code, ent_code: ent_code,
thread: tid, thread: tid,
level:1 level:1,
status:{
$ne:2
}
}; };
if (content) { if (content) {
conditions.content = { conditions.content = {
......
...@@ -440,7 +440,10 @@ function getCommentBatchOperateConditions(req){ ...@@ -440,7 +440,10 @@ function getCommentBatchOperateConditions(req){
var conditions = { var conditions = {
ent_code: ent_code, ent_code: ent_code,
thread: tid, thread: tid,
level:1 level:1,
status:{
$ne:2
}
}; };
if (content) { if (content) {
conditions.content = { conditions.content = {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment