Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pisns-forum-api
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
scrmGroup
pisns-forum-api
Commits
8ad7baff
Commit
8ad7baff
authored
Jan 20, 2016
by
刘文胜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改文件编码为utf-8
parent
697aacc1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
floorGenerator.js
app/utils/floorGenerator.js
+7
-7
No files found.
app/utils/floorGenerator.js
View file @
8ad7baff
...
...
@@ -2,7 +2,7 @@
var
redis
=
global
.
redis
;
var
prefix
=
'_forum_floor_generator_'
;
var
expire
=
60
*
30
;
//
半个小时
var
expire
=
60
*
30
;
//
半个小时
var
forumCommentService
=
require
(
'../service/forumCommentService'
);
...
...
@@ -11,8 +11,8 @@ function getKey(entcode,id){
}
/*
获取帖子的评论的楼层
tid:
帖子
id
获取帖子的评论的楼层
tid:
帖子i
d
*/
exports
.
getCommentFloor
=
function
(
entcode
,
tid
,
callback
){
var
key
=
getKey
(
entcode
,
tid
);
...
...
@@ -20,11 +20,11 @@ exports.getCommentFloor=function(entcode,tid,callback){
console
.
log
(
'redis error'
);
return
callback
&&
callback
(
'redis error'
);
}
redis
.
get
(
key
,
function
(
error
,
floor
){
//
先判断楼层计数器是否存在
redis
.
get
(
key
,
function
(
error
,
floor
){
//
先判断楼层计数器是否存在
if
(
error
){
return
callback
&&
callback
(
error
);
}
if
(
floor
){
//
存在,就直接累加
if
(
floor
){
//
存在,就直接累加
redis
.
incr
(
key
,
function
(
error
,
newfloor
){
if
(
error
){
return
callback
&&
callback
(
error
);
...
...
@@ -32,11 +32,11 @@ exports.getCommentFloor=function(entcode,tid,callback){
redis
.
expire
(
key
,
expire
);
return
callback
&&
callback
(
error
,
newfloor
||
1
);
});
}
else
{
//
不存在
}
else
{
//
不存在
redis
.
set
(
key
,
0
);
redis
.
watch
(
key
);
var
multi
=
redis
.
multi
();
//
获取评论的最新楼层
//
获取评论的最新楼层
forumCommentService
.
count
({
thread
:
tid
,
level
:
'1'
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment