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
caade030
Commit
caade030
authored
Jul 28, 2016
by
陈志良
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.修改子帖子缓存2秒
2.增加用户经验查询2分钟缓存
parent
9c9a29b3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
9 deletions
+20
-9
forumThread.js
app/controllers/mobile/forumThread.js
+1
-1
util.js
app/utils/util.js
+19
-8
No files found.
app/controllers/mobile/forumThread.js
View file @
caade030
...
...
@@ -2444,7 +2444,7 @@ router.get('/thread/:tid/get/subThreads/:type', function(req, res, next) {
handleThreadList
(
req
,
results
,
ent_code
,
function
(
result
){
console
.
log
(
"查询用户对帖子点赞耗时:"
+
Math
.
abs
(
new
Date
()
-
handleThreadListBegin
));
redis
.
set
(
key
,
JSON
.
stringify
(
result
));
redis
.
expire
(
key
,
5
);
redis
.
expire
(
key
,
2
);
res
.
json
(
_
.
assign
(
result
,
returnCode
.
SUCCESS
));
});
});
...
...
app/utils/util.js
View file @
caade030
...
...
@@ -127,14 +127,25 @@ function loadLevelFromAPI(ent_code,open_id,callback){
if
(
!
ent_code
||
!
open_id
){
return
callback
&&
callback
(
null
,
null
);
}
var
url
=
API_ADDRESS
+
'/v1.0/internal/member/exp/byopenid?openId='
+
open_id
+
'&entCode='
+
ent_code
;
request
.
get
({
url
:
url
,
json
:
{}
},
function
(
e
,
r
,
body
)
{
if
(
e
)
{
console
.
log
(
e
)
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
);
}
else
{
var
url
=
API_ADDRESS
+
'/v1.0/internal/member/exp/byopenid?openId='
+
open_id
+
'&entCode='
+
ent_code
;
request
.
get
({
url
:
url
,
json
:
{}
},
function
(
e
,
r
,
body
)
{
if
(
e
)
{
console
.
log
(
e
)
}
if
(
body
&&
body
.
data
){
redis
.
set
(
key
,
body
.
data
);
redis
.
expire
(
key
,
2
*
60
);
}
return
callback
&&
callback
(
null
,(
body
&&
body
.
data
)
||
null
);
});
}
return
callback
&&
callback
(
null
,(
body
&&
body
.
data
)
||
null
);
});
};
\ No newline at end of file
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