Commit d20ad695 authored by strong's avatar strong

Merge branch 'bugfix_0118_info_delete' into SANDBOX

parents c0645f67 0e781225
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
var redis=global.redis; var redis=global.redis;
var prefix = '_forum_floor_generator_'; var prefix = '_forum_floor_generator_';
var expire =60 * 30;//半个小时 var expire = 60 * 30;//半个小时
var forumCommentService = require('../service/forumCommentService'); var forumCommentService = require('../service/forumCommentService');
...@@ -11,8 +11,8 @@ function getKey(entcode,id){ ...@@ -11,8 +11,8 @@ function getKey(entcode,id){
} }
/* /*
获取帖子的评论的楼层 获取帖子的评论的楼层
tid:帖子id tid:帖子id
*/ */
exports.getCommentFloor=function(entcode,tid,callback){ exports.getCommentFloor=function(entcode,tid,callback){
var key = getKey(entcode,tid); var key = getKey(entcode,tid);
...@@ -33,7 +33,6 @@ exports.getCommentFloor=function(entcode,tid,callback){ ...@@ -33,7 +33,6 @@ exports.getCommentFloor=function(entcode,tid,callback){
return callback && callback(error, newfloor || 1); return callback && callback(error, newfloor || 1);
}); });
}else{//不存在 }else{//不存在
redis.set(key,0);
redis.watch(key); redis.watch(key);
var multi = redis.multi(); var multi = redis.multi();
//获取评论的最新楼层 //获取评论的最新楼层
...@@ -42,6 +41,7 @@ exports.getCommentFloor=function(entcode,tid,callback){ ...@@ -42,6 +41,7 @@ exports.getCommentFloor=function(entcode,tid,callback){
level: '1' level: '1'
}, function(err, count) { }, function(err, count) {
if (err) { if (err) {
multi.discard();
return callback && callback(err); return callback && callback(err);
} }
var newfloor = (count || 0) + 1; var newfloor = (count || 0) + 1;
......
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