Commit a3b4d615 authored by 陈志良's avatar 陈志良

增加子帖子缓存

parent 3eab2e24
......@@ -473,11 +473,11 @@ exports.getThreadById = function(tid, callback) {
var subThreads = results[1] || []; //话题子文章列表
// var latestPhotos = results[2] || []; //最新照片墙列表
// var hotPhotos = results[3] || []; //最热照片墙列表
var canyuPeopleCount = results[1] || 0; //参与人数
var canyuPeopleCount = results[2] || 0; //参与人数
var threadObj = thread && thread.toObject() || {};
threadObj.comments = comments;
// threadObj.subThreads = subThreads;
threadObj.subThreads = subThreads;
// threadObj.latestPhotos = latestPhotos;
// threadObj.hotPhotos = hotPhotos;
threadObj.canyuPeopleCount = canyuPeopleCount;
......
......@@ -130,7 +130,7 @@ function loadLevelFromAPI(ent_code,open_id,callback){
var key = 'pisns-forum-thread:' +ent_code+':'+ open_id + ':exp';
redis.get(key,function(err,value){
if (value) {
return callback && callback(null,Number(value) || null);
return callback && callback(null,JSON.parse(value) || null);
} else {
var url = API_ADDRESS + '/v1.0/internal/member/exp/byopenid?openId='+open_id+'&entCode='+ent_code;
request.get({
......@@ -141,7 +141,7 @@ function loadLevelFromAPI(ent_code,open_id,callback){
console.log(e)
}
if(body && body.data){
redis.set(key, body.data);
redis.set(key, JSON.stringify(body.data));
redis.expire(key,2 * 60 );
}
return callback && callback(null,(body && body.data) || null);
......
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