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

Merge branch 'newfunc_0510_forum_management' into SANDBOX

parents c9a67aea 69af64b8
......@@ -157,6 +157,7 @@ router.post('/thread/create', function(req, res, next) {
router.get('/thread/:tid/get', function(req, res, next) {
var uid = req.session.user.id;
var tid = req.params.tid || null;
var ent_code = req.session.user.ent_code;
var rs = {};
if (tid) {
async.waterfall([
......@@ -172,7 +173,7 @@ router.get('/thread/:tid/get', function(req, res, next) {
function(thread, callback) {
if (thread && thread.info && thread.info._id) {
forumTagService.getAllTag({
ent_code: req.session.user.ent_code,
ent_code: ent_code,
info: thread.info._id
}, 1, 100, function(err, results) {
if (err) {
......@@ -195,6 +196,20 @@ router.get('/thread/:tid/get', function(req, res, next) {
callback(null, datas);
}
});
},
function(datas, callback) { //获取EXP
if(datas[0].from.mid){
userUtil.getMemberExp(ent_code, datas[0].from.mid, 3, function(err, results) {
if (err) {
callback(err, null);
} else {
datas.push(results)
callback(null, datas);
}
});
}else{
callback(null, datas);
}
}
], function(err, results) {
if (err) {
......@@ -210,6 +225,7 @@ router.get('/thread/:tid/get', function(req, res, next) {
if (results[0].pid) {
forumThreadService.getById(results[0].pid, function(err, parentThread) {
rs.data = results[0];
rs.data.from.exp = results[3] && results[3].allExp ? results[3].allExp : 0;
rs.tagList = results[1];
rs.parentThread = parentThread;
rs.isSameAuthor = isSameAuthor;
......@@ -217,6 +233,7 @@ router.get('/thread/:tid/get', function(req, res, next) {
});
} else {
rs.data = results[0];
rs.data.from.exp = results[3] && results[3].allExp ? results[3].allExp : 0;
rs.tagList = results[1];
rs.isSameAuthor = isSameAuthor;
res.json(_.assign(rs, returnCode.SUCCESS));
......
......@@ -330,21 +330,29 @@ exports.getThreadById = function(tid, callback) {
},
function(cb) {
//获取话题子文章列表
if (doc.type !== 2) {
cb(null, null);
return;
}
var conditions = {
var conditions ={}
if(doc.type == 2){
conditions = {
pid: tid,
type: 2,
status:1
};
getAllThreadByFidHelp(conditions, 1, 10, null, function(err, threads) {
}else if(doc.type == 3){
conditions = {
pid: tid,
type: 3,
status:1,
images: {$exists: true, $not: {$size: 0}}
};
}else{
cb(null, null);
return;
}
getAllThreadByFidHelp(conditions, 1, 999999, null, function(err, threads) {
if (err) {
console.error(err);
cb(err, null);
} else {
// console.log(threads);
cb(null, threads);
}
});
......
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