|
@ -303,13 +303,17 @@ class Sessions extends RedisModel {
|
|
|
redis.zaddAsync(user_session_key, Commons.STICK_NUM,sessionId).then(function(res){
|
|
|
log.info("stickSession:"+sessionId+",res:"+res);
|
|
|
modelUtil.emitData(self.eventEmitter,{"status":200,"msg":"置顶成功!"});
|
|
|
}).then(function(){
|
|
|
SessionRepo.stickSession(sessionId,user,Commons.STICK_NUM);
|
|
|
})
|
|
|
}else{
|
|
|
//已有置顶的数据,取出来加1保存回去
|
|
|
scoreres = scoreres+1;
|
|
|
scoreres = Number(scoreres)+1;
|
|
|
redis.zaddAsync(user_session_key, scoreres,sessionId).then(function(){
|
|
|
log.info("stickSession:"+sessionId+",res:"+res);
|
|
|
modelUtil.emitData(self.eventEmitter,{"status":200,"msg":"置顶成功!"});
|
|
|
}).then(function(){
|
|
|
SessionRepo.stickSession(sessionId,user,scoreres);
|
|
|
})
|
|
|
}
|
|
|
})
|
|
@ -330,6 +334,8 @@ class Sessions extends RedisModel {
|
|
|
redis.zaddAsync(user_session_key, res,sessionId).then(function(res){
|
|
|
log.info("cancelStickSession:"+sessionId);
|
|
|
modelUtil.emitData(self.eventEmitter,{"status":200,"msg":"取消置顶成功!"});
|
|
|
}).then(function(){
|
|
|
SessionRepo.unstickSession(sessionId,user);
|
|
|
});
|
|
|
})
|
|
|
}
|