Commit 8a8031d4 authored by 邓军's avatar 邓军

添加搜索条件

parent 8eb70843
...@@ -226,6 +226,8 @@ router.get('/threads/list', function(req, res, next) { ...@@ -226,6 +226,8 @@ router.get('/threads/list', function(req, res, next) {
var tagId = req.query.tagId; var tagId = req.query.tagId;
var pid = req.query.pid; var pid = req.query.pid;
var content = req.query.content; var content = req.query.content;
var type = req.query.type;
var status = req.query.status;
var conditions = { var conditions = {
ent_code: req.session.user.ent_code, ent_code: req.session.user.ent_code,
level: 1 level: 1
...@@ -248,17 +250,24 @@ router.get('/threads/list', function(req, res, next) { ...@@ -248,17 +250,24 @@ router.get('/threads/list', function(req, res, next) {
conditions.content = { conditions.content = {
$regex: content, $regex: content,
$options: 'i' $options: 'i'
};
} }
if(type){
conditions.type = type;
} }
if(status){
conditions.status = status;
}
forumThreadService.getAllThreadByFid(conditions, pageNo, pageSize, null, function(err, results) { forumThreadService.getAllThreadByFid(conditions, pageNo, pageSize, null, function(err, results) {
if (err) { if (err) {
console.error(err); console.error(err);
res.json(returnCode.BUSY); res.json(returnCode.BUSY);
} else { } else {
if (results.items.length>0 &&results.items[0].pid) { if (pid) {
forumThreadService.getById(results.items[0].pid, function(err, parentThread) { forumThreadService.getById(pid, function(err, parentThread) {
res.json(_.assign({ res.json(_.assign({
parentThread: parentThread parentThread: parentThread
}, results, returnCode.SUCCESS)); }, results, returnCode.SUCCESS));
......
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