diff --git a/server/jobs/syncHeytripJobs.js b/server/jobs/syncHeytripJobs.js index 53038c0..cdf5cd5 100644 --- a/server/jobs/syncHeytripJobs.js +++ b/server/jobs/syncHeytripJobs.js @@ -42,7 +42,7 @@ const Aids = () => { * 每天启动同步; */ const AidsState = () => { - const dailyJob = scheduleJob('0 0 0 * * *', async function () { + const dailyJob = scheduleJob('0 0 0 * * *', async function () { // debug: 1 // const dailyJob = scheduleJob('0 20 9 * * *', async function () { const jobAS = scheduleJob('*/2 * * * * *', async function () { console.log('--------------------syncing heytrip, get available accommodation ids.--------------------'); diff --git a/server/services/heytripService.js b/server/services/heytripService.js index c9a8a79..2fa4544 100644 --- a/server/services/heytripService.js +++ b/server/services/heytripService.js @@ -180,16 +180,18 @@ class Heytrip { const stateOff = await HeytripIds.findAll({ raw: true, logging: false, where: { - update_flag: 99, - page_index: { [Op.lt]: 0 }, - last_modify_time: { [Op.gt]: today }, + // update_flag: 99, + // page_index: { [Op.lt]: 0 }, + // last_modify_time: { [Op.gt]: today }, + last_modify_time: { [Op.lt]: today }, }, attributes: ['hotel_id'], }); const stateOffIds = stateOff.map((item) => item.hotel_id); if (!isEmpty(stateOffIds)) { - await HeytripIds.update({ update_flag: 99, priority: 99 }, { where: { hotel_id: stateOffIds }, logging: false, }); - console.log('updated stateOff', stateOffIds.length); + // await HeytripIds.update({ update_flag: 99, priority: 99 }, { where: { hotel_id: stateOffIds }, logging: false, }); + // console.log('updated stateOff', stateOffIds.length); + await HeytripIds.update({ update_flag: 99, priority: 99, page_index: Sequelize.literal('-page_index') }, { where: { last_modify_time: { [Op.lt]: today }, }, logging: false, }); } return { nextPage: false, @@ -221,7 +223,7 @@ class Heytrip { // 页码滚动 const oldToNext = savedPageIds.filter((item) => !validIds.includes((item.hotel_id))).map((item) => item.hotel_id); if (!isEmpty(oldToNext)) { - await HeytripIds.update({ page_index: -Number(pageIndex), update_flag: 99 }, { where: { hotel_id: oldToNext },logging: false, }); + await HeytripIds.update({ page_index: -Number(pageIndex), update_flag: 99, }, { where: { hotel_id: oldToNext },logging: false, }); } return {