method.js
1.1 KB
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()
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()
return {
startTime,
endTime,
ymd:year + "-" + month + "-" + date
}
},
dayTimeYMD() {
let dayTimeDate = new Date()
let year = dayTimeDate.getFullYear()
let month = dayTimeDate.getMonth() + 1
let date = dayTimeDate.getDate()
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}`
let result = await axios.get(axiosUrl)
return result
},
}
module.exports = methods