Commit 811fcebd authored by 杨翌文's avatar 杨翌文

优化查询版块的逻辑

parent d001a011
......@@ -68,18 +68,13 @@ router.get('/info/:fid/get', function(req, res, next) {
if (fid) {
var source = req.session.mobileForumUser.source;
httpService.createLog(req, source, fid, 2);
async.waterfall([
forumInfoService.updateInfoPvCount(fid, function(err, result) {
if (err) {
console.error(err);
}
});
async.parallel([
function(callback) {
//更新浏览数
forumInfoService.updateInfoPvCount(fid, function(err, result) {
if (err) {
callback(err, null);
} else {
callback(null, null);
}
});
},
function(data, callback) {
forumInfoService.getInfoById(fid, function(err, info) {
if (err) {
callback(err, null);
......@@ -93,20 +88,20 @@ router.get('/info/:fid/get', function(req, res, next) {
info: fid
}, function(err, threadCount) {
if (err) {
callback(err, null, null);
callback(err, null);
} else {
callback(null, info, threadCount);
callback(null, threadCount);
}
});
}
], function(err, info, threadCount) {
], function(err, results) {
if (err) {
console.error(err);
res.json(returnCode.BUSY);
} else {
var rs = {};
rs.data = info;
rs.data.threadCount = threadCount;
rs.data = results[0];
rs.data.threadCount = results[1];
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