Commit f829bd3b authored by 陈家荣's avatar 陈家荣

新圈子首页接口开发

parent 4a8f4085
......@@ -1769,52 +1769,12 @@ router.post('/thread/:tid/disable', function(req, res, next) {
}
});
//获取推荐文章 //旧的,无用 2016/1/29日后请删除
router.get('/thread/getThreadWithEssence_old', function(req, res, next) {
var pageNo = req.query.pageNo || 1;
var pageSize = req.query.pageSize || 10;
var infoId = req.query.infoId || null;
var sort = '-new_recommend_time';
var ent_code = req.session.user.ent_code;
var today = new Date();
var conditions = {
ent_code: ent_code,
level: 1,
status: 1,
new_recommend: 1,
$or: [{
isEvent: 0
}, {
isEvent: null
}, {
isEvent: 1,
'event.eventStartTime' : {$lte : today}
}]
};
if(infoId){
conditions.info = infoId;
}
queryThread(conditions, pageNo, pageSize, sort, function(err, results){
if(err){
console.error(err);
res.json(returnCode.BUSY);
}else{
util.loadLevel(ent_code, results.items, function() {
handleThreadList(req, results, ent_code, function(result){
res.json(_.assign(result, returnCode.SUCCESS));
});
});
}
});
});
//查询帖子列表数据,不获取评论,话题获取参与用
router.get('/thread/getThreadWithNotPopulateComment', function(req, res, next) {
var pageNo = req.query.pageNo || 1;
var pageSize = req.query.pageSize || 10;
var infoId = req.query.infoId || null;
var tagid = req.query.tagid || null;
var sort = '-_id';
var ent_code = req.session.user.ent_code;
var today = new Date();
......@@ -1834,6 +1794,9 @@ router.get('/thread/getThreadWithNotPopulateComment', function(req, res, next) {
if(infoId){
conditions.info = infoId;
}
if(tagid){
conditions.tag={$in:[tagid]};
}
queryThread(conditions, pageNo, pageSize, sort, function(err, results){
if(err){
console.error(err);
......@@ -1979,3 +1942,46 @@ function handleThreadList(req, results, ent_code, callback){
});
}
//新圈子首页帖子列表 最热
router.get('/thread/getThreadWithNotPopulateComment/hot', function(req, res, next) {
var pageNo = req.query.pageNo || 1;
var pageSize = req.query.pageSize || 10;
var infoId = req.query.infoId || null;
var tagid = req.query.tagid || null;
var sort = '-top -topTime -_id';
var ent_code = req.session.user.ent_code;
var today = new Date();
var conditions = {
ent_code: ent_code,
level: 1,
status: 1,
$or: [{
isEvent: 0
}, {
isEvent: null
}, {
isEvent: 1,
'event.eventStartTime' : {$lte : today}
}]
};
if(infoId){
conditions.info = infoId;
}
if(tagid){
sort = "-tag_top -tag_topTime -_id";
conditions.tag={$in:[tagid]};
}
queryThread(conditions, pageNo, pageSize, sort, function(err, results){
if(err){
console.error(err);
res.json(returnCode.BUSY);
}else{
util.loadLevel(ent_code, results.items, function() {
handleThreadList(req, results, ent_code, function(result){
res.json(_.assign(result, returnCode.SUCCESS));
});
});
}
});
});
\ No newline at end of file
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