|
|
|
@ -44,6 +44,7 @@ const Aids = () => {
|
|
|
|
|
*/
|
|
|
|
|
const AidsState = () => {
|
|
|
|
|
const dailyJob = scheduleJob('0 0 0 * * *', async function () {
|
|
|
|
|
// const dailyJob = scheduleJob('0 20 9 * * *', async function () {
|
|
|
|
|
const jobAS = scheduleJob('*/2 * * * * *', async function () {
|
|
|
|
|
console.log('--------------------syncing heytrip, get available accommodation ids.--------------------');
|
|
|
|
|
const isRunning = jobAS.pendingInvocations[0]?.job?.running == 1;
|
|
|
|
@ -64,14 +65,15 @@ const AidsState = () => {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取新增的酒店详情
|
|
|
|
|
* ID同步结束后启动, ID大约需要3小时
|
|
|
|
|
* ID同步结束后启动, ID每10W 条大约需要半小时
|
|
|
|
|
* 每天03:05:00启动
|
|
|
|
|
*/
|
|
|
|
|
const newHotelDetails = () => {
|
|
|
|
|
// return false;
|
|
|
|
|
const dailyJob1 = scheduleJob('0 5 3 * * *', async function () {
|
|
|
|
|
// const dailyJob1 = scheduleJob('0 5 12 * * *', async function () {
|
|
|
|
|
const job1 = scheduleJob('*/5 * * * * *', async function () {
|
|
|
|
|
console.log('-------------------------syncing heytrip, get accommodation details.-------------------------');
|
|
|
|
|
console.log('-------------------------syncing heytrip[newHotelDetails], get accommodation details.-------------------------');
|
|
|
|
|
|
|
|
|
|
const isRunning = job1.pendingInvocations[0]?.job?.running == 1;
|
|
|
|
|
if (!isRunning) {
|
|
|
|
@ -99,7 +101,7 @@ const hotelLgcDetails = () => {
|
|
|
|
|
// return false;
|
|
|
|
|
const dailyJob2 = scheduleJob('0 5 20 * * 5', async function () {
|
|
|
|
|
const job2 = scheduleJob('*/5 * * * * *', async function () {
|
|
|
|
|
console.log('-------------------------syncing heytrip, get accommodation details.-------------------------');
|
|
|
|
|
console.log('-------------------------syncing heytrip[hotelLgcDetails], get accommodation details.-------------------------');
|
|
|
|
|
|
|
|
|
|
const isRunning = job2.pendingInvocations[0]?.job?.running == 1;
|
|
|
|
|
if (!isRunning) {
|
|
|
|
@ -127,7 +129,7 @@ const chinaHotelDetails = () => {
|
|
|
|
|
// return false;
|
|
|
|
|
const dailyJobCN = scheduleJob('0 5 20 * * 6', async function () {
|
|
|
|
|
const job3 = scheduleJob('*/4 * * * * *', async function () {
|
|
|
|
|
console.log('-------------------------syncing heytrip, get china accommodation details.-------------------------');
|
|
|
|
|
console.log('-------------------------syncing heytrip[chinaHotelDetails], get china accommodation details.-------------------------');
|
|
|
|
|
const isRunning = job3.pendingInvocations[0]?.job?.running == 1;
|
|
|
|
|
if (!isRunning) {
|
|
|
|
|
const res = await heytripService.chinaHotelsLgc2('2');
|
|
|
|
@ -138,7 +140,7 @@ const chinaHotelDetails = () => {
|
|
|
|
|
// job3.reschedule('0 0 0 * * *');
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
console.log('pre job running! cancelNext');
|
|
|
|
|
console.log('pre job running! cancelNext[chinaHotelDetails]');
|
|
|
|
|
job3.cancelNext();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|