schedule.js
666 Bytes
const schedule = require('node-schedule')
const service = require('./server/service')
function scheduleMain() {
const ruleIn = new schedule.RecurrenceRule()
ruleIn.hour = 8
ruleIn.minute = 30
// ruleIn.hour = 17
// ruleIn.minute = 0
schedule.scheduleJob(ruleIn, function(){
service.checkinAll()
});
const ruleOut = new schedule.RecurrenceRule()
ruleOut.hour = 18
ruleOut.minute = 0
// ruleOut.hour = 17
// ruleOut.minute = 0
schedule.scheduleJob(ruleOut, function(){
service.checkoutAll()
});
// service.checkinAll()
// service.checkoutAll()
console.log('schedule start')
}
module.exports = {
start: scheduleMain
}