Commit 1e833915 authored by qinhaitao's avatar qinhaitao

fix: 🐛 bug

parent f2a2c3ad
......@@ -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) {
......
......@@ -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
......
......@@ -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 })
......
......@@ -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 // 是否补签
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment