Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
taobao-mini-template
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
qinhaitao
taobao-mini-template
Commits
1e833915
Commit
1e833915
authored
Jan 21, 2021
by
qinhaitao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:
🐛
bug
parent
f2a2c3ad
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
7 deletions
+12
-7
requestRateLimit.ts
v2.0/src/decorator/common/requestRateLimit.ts
+2
-1
sign.service.ts
v2.0/src/service/common/sign.service.ts
+5
-2
stat.service.ts
v2.0/src/service/common/stat.service.ts
+3
-2
sign.d.ts
v2.0/src/typings/sign.d.ts
+2
-2
No files found.
v2.0/src/decorator/common/requestRateLimit.ts
View file @
1e833915
...
...
@@ -2,6 +2,7 @@
import
{
resultsModel
}
from
'../../sdk'
import
{
CODE_TYPES
}
from
'../../constants'
import
{
logFn
,
recordErrorLog
}
from
'../../utils'
import
{
formatDate
}
from
'../../utils/common/date'
// 限制请求频率 rate单位 ms
export
default
function
requestRateLimit
(
rate
=
500
)
{
...
...
@@ -29,7 +30,7 @@ export default function requestRateLimit(rate = 500) {
[
activityId
,
openId
,
handler
,
1
]
)
}
else
{
const
lastRequestTime
=
new
Date
(
handlerRecord
.
gmt_modified
).
getTime
()
const
lastRequestTime
=
formatDate
(
handlerRecord
.
gmt_modified
).
getTimestamp
()
const
now
=
Date
.
now
()
if
(
now
-
lastRequestTime
<
rate
)
{
...
...
v2.0/src/service/common/sign.service.ts
View file @
1e833915
...
...
@@ -10,6 +10,7 @@ import { ACTIVITY_STATUS } from '../../constants'
import
UserService
from
'./user.service'
import
{
getToday
}
from
'../../utils'
import
{
CODE_TYPES
}
from
'../../errorCode'
import
{
formatDate
}
from
'../../utils/common/date'
export
default
class
SignService
extends
UserService
{
context
:
IContext
<
any
>
...
...
@@ -29,9 +30,11 @@ export default class SignService extends UserService {
userNick
,
isSignLater
:
!!
subscribeSignDay
,
createDay
:
today
,
signTime
:
subscribeSignDay
?
new
Date
(
subscribeSignDay
)
:
new
Date
(),
signTime
:
subscribeSignDay
?
formatDate
(
subscribeSignDay
).
format
(
'YYYY-MM-DD'
)
:
formatDate
().
format
(
'YYYY-MM-DD'
),
signDay
:
subscribeSignDay
||
today
,
createTime
:
new
Date
()
createTime
:
Date
.
now
()
})
if
(
!
signResult
)
return
CODE_TYPES
.
SYSTEM_ERROR
...
...
v2.0/src/service/common/stat.service.ts
View file @
1e833915
...
...
@@ -9,6 +9,7 @@ import { STAT_DB_NAME, ACCESS_DB_NAME, USER_DB_NAME, AWARDS_DB_NAME, JOIN_DB_NAM
import
*
as
xlsx
from
'node-xlsx'
import
{
getToday
}
from
'../../utils'
import
{
STAT_TYPE
}
from
'../../constants'
import
{
formatDate
}
from
'../../utils/common/date'
export
default
class
StatService
{
context
:
IContext
<
any
>
...
...
@@ -60,8 +61,8 @@ export default class StatService {
let
day
=
startDay
const
oneDay
=
24
*
3600
*
1000
let
xlsxData
=
[]
let
curDayTimestamp
=
new
Date
(
day
).
getTime
()
const
endDayTimestamp
=
new
Date
(
endDay
).
getTime
()
let
curDayTimestamp
=
formatDate
(
day
).
getTimestamp
()
const
endDayTimestamp
=
formatDate
(
endDay
).
getTimestamp
()
while
(
curDayTimestamp
<=
endDayTimestamp
)
{
// 访问PV
const
PV
=
await
this
.
accessdao
.
count
({
activityId
,
createDay
:
day
})
...
...
v2.0/src/typings/sign.d.ts
View file @
1e833915
...
...
@@ -4,9 +4,9 @@ interface IUserSign {
activityId
:
string
openId
:
string
userNick
:
string
createTime
:
Date
createTime
:
number
createDay
:
string
signTime
:
Date
signTime
:
string
signDay
:
string
isSignLater
?:
boolean
// 是否补签
}
...
...
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