Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuy-node
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
1
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Plain Diff
Browse Files
Authored by
周少峰
8 years ago
Commit
52ffc80e2b2638f5d62d78ae175400130d5fbb31
2 parents
83464663
707b14b2
Merge branch 'hotfix/pz'
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
4 deletions
apps/cart/controllers/cart.js
doraemon/middleware/limiter/rules/qps-limit.js
package.json
public/js/cart/ensure.page.js
apps/cart/controllers/cart.js
View file @
52ffc80
...
...
@@ -55,7 +55,7 @@ const getCoupons = (req, res, next) => {
*/
const
setShoppingCookie
=
(
req
,
res
)
=>
{
let
uid
=
req
.
user
.
uid
||
true
;
let
uid
=
req
.
user
.
uid
;
let
shoppingKey
=
helper
.
getShoppingKeyByCookie
(
req
);
return
service
.
getCartCount
(
uid
,
shoppingKey
).
then
(
ret
=>
{
...
...
doraemon/middleware/limiter/rules/qps-limit.js
View file @
52ffc80
...
...
@@ -29,6 +29,8 @@ module.exports = (limiter, policy) => {
const
key
=
`
pc
:
limiter
:
$
{
limiter
.
remoteIp
}
`
;
let
isNew
=
false
;
res
.
on
(
'render'
,
function
()
{
let
route
=
req
.
route
?
req
.
route
.
path
:
''
;
let
appPath
=
req
.
app
.
mountpath
;
...
...
@@ -44,7 +46,7 @@ module.exports = (limiter, policy) => {
pageIncr
=
5
;
}
if
(
pageIncr
>
0
)
{
if
(
pageIncr
>
0
&&
!
isNew
)
{
cache
.
incrAsync
(
key
,
pageIncr
);
}
});
...
...
@@ -70,6 +72,7 @@ module.exports = (limiter, policy) => {
}
}
else
{
cache
.
setAsync
(
key
,
1
,
60
);
// 设置key,1m失效
isNew
=
true
;
return
Promise
.
resolve
(
true
);
}
});
...
...
package.json
View file @
52ffc80
{
"name"
:
"yohobuy-node"
,
"version"
:
"5.4.1
2
"
,
"version"
:
"5.4.1
3
"
,
"private"
:
true
,
"description"
:
"A New Yohobuy Project With Express"
,
"repository"
:
{
...
...
public/js/cart/ensure.page.js
View file @
52ffc80
...
...
@@ -772,7 +772,7 @@ $('#order-submit').click(function() {
window
.
_fxcmd
.
push
([
'trackOrder'
,
{
oid
:
rdata
.
order_code
,
otp
:
rdata
.
order_amount
,
u_info
:
window
.
getU
ser
(),
u_info
:
window
.
getU
id
(),
u_type
:
newUser
},
[]]);
window
.
setCookie
(
'__NEW_USER'
,
0
);
...
...
Please
register
or
login
to post a comment