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

添加搜索条件

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