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

在帖子详情页,也要将用户的exp经验值带上

parent 8586daff
......@@ -156,6 +156,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([
......@@ -171,7 +172,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) {
......@@ -194,6 +195,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) {
......@@ -209,6 +224,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;
......@@ -216,6 +232,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));
......
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