diff --git a/server/jobs/syncHeytripJobs.js b/server/jobs/syncHeytripJobs.js index cdf5cd5..2ed2652 100644 --- a/server/jobs/syncHeytripJobs.js +++ b/server/jobs/syncHeytripJobs.js @@ -48,11 +48,15 @@ const AidsState = () => { console.log('--------------------syncing heytrip, get available accommodation ids.--------------------'); const isRunning = jobAS.pendingInvocations[0]?.job?.running == 1; if (!isRunning) { - const res = await heytripService.syncAidState(); - // jobAS.cancel(); // debug: 0 - if (res.nextPage !== true) { - console.log('job completed! canceled job[AidsState]!'); - jobAS.cancel(); + try { + const res = await heytripService.syncAidState(); + // jobAS.cancel(); // debug: 0 + if (res.nextPage !== true) { + console.log('job completed! canceled job[AidsState]!'); + jobAS.cancel(); + } + } catch (error) { + } } else { console.log('pre job running! cancelNext[AidsState]'); diff --git a/server/services/heytripService.js b/server/services/heytripService.js index 2fa4544..1b07c5e 100644 --- a/server/services/heytripService.js +++ b/server/services/heytripService.js @@ -212,7 +212,7 @@ class Heytrip { // 已存在ID: 更新: 状态, 页码, 时间 const stateNormal = savedIds.filter((item) => validIds.includes((item.hotel_id))).map((item) => item.hotel_id); if (!isEmpty(stateNormal)) { - await HeytripIds.update({ update_flag: 0, priority: 0, page_index: pageIndex, last_modify_time: Sequelize.fn('NOW') }, { where: { hotel_id: stateNormal } ,logging: false, }); + await HeytripIds.update({ update_flag: 0, priority: Sequelize.literal('priority+5'), page_index: pageIndex, last_modify_time: Sequelize.fn('NOW') }, { where: { hotel_id: stateNormal } ,logging: false, }); } // 新增ID const newIds = validIds.filter((id) => !savedIds.map((item) => item.hotel_id).includes(id)); @@ -264,7 +264,7 @@ class Heytrip { WHERE h.hi2_sn IS NULL AND update_flag != 99 -- AND update_flag = 0 - ORDER BY info_exists,priority LIMIT 10` + ORDER BY priority LIMIT 10` , { logging: false } ); const res = await this.syncInitHotelLgcDetailsAction(rows, LGC_MAPPED[lgc]);