method.js
1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
const axios = require('axios');
const methods = {
YesterdayTime() {
let YesterdayTime = (new Date).getTime() - 24 * 60 * 60 * 1000
let YesterdayTimeDate = new Date(YesterdayTime)
let year = YesterdayTimeDate.getFullYear()
year = year.toString()
let month = YesterdayTimeDate.getMonth() + 1
let date = YesterdayTimeDate.getDate()
let startTime = new Date(year + "-" + month + "-" + date + " 5:30:00").getTime()
let endTime = new Date(year + "-" + month + "-" + date + " 23:59:00").getTime()
if (month < 10) {
month = '0' + month
}else{
month = month.toString()
}
if (date < 10) {
date = '0' + date
}else{
date = date.toString()
}
return {
startTime,
endTime,
ymd: year + month + date
}
},
dayTimeYMD() {
let dayTimeDate = new Date()
let year = dayTimeDate.getFullYear()
year = year.toString()
let month = dayTimeDate.getMonth() + 1
let date = dayTimeDate.getDate()
if (month < 10) {
month = '0' + month
}else{
month = month.toString()
}
if (date < 10) {
date = '0' + date
}else{
date = date.toString()
}
return {
ymd: year + month + date
}
},
async getRequestClassIds(url, siteId, key, startTime, endTime, page) {
let axiosUrl = `${url}?siteId=${siteId}&key=${key}&from=${startTime}&to=${endTime}&page=${page}`
console.log('axiosUrl', axiosUrl)
let result = await axios.get(axiosUrl)
return result
},
}
module.exports = methods