|
|
@ -191,7 +191,7 @@ class Heytrip {
|
|
|
|
if (!isEmpty(stateOffIds)) {
|
|
|
|
if (!isEmpty(stateOffIds)) {
|
|
|
|
// await HeytripIds.update({ update_flag: 99, priority: 99 }, { where: { hotel_id: stateOffIds }, logging: false, });
|
|
|
|
// await HeytripIds.update({ update_flag: 99, priority: 99 }, { where: { hotel_id: stateOffIds }, logging: false, });
|
|
|
|
// console.log('updated stateOff', stateOffIds.length);
|
|
|
|
// 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, });
|
|
|
|
await HeytripIds.update({ update_flag: 99, priority: 99, page_index: Sequelize.literal('-page_index'), last_modify_time: Sequelize.fn('NOW') }, { where: { last_modify_time: { [Op.lt]: today }, }, logging: false, });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
nextPage: false,
|
|
|
|
nextPage: false,
|
|
|
@ -223,7 +223,7 @@ class Heytrip {
|
|
|
|
// 页码滚动
|
|
|
|
// 页码滚动
|
|
|
|
const oldToNext = savedPageIds.filter((item) => !validIds.includes((item.hotel_id))).map((item) => item.hotel_id);
|
|
|
|
const oldToNext = savedPageIds.filter((item) => !validIds.includes((item.hotel_id))).map((item) => item.hotel_id);
|
|
|
|
if (!isEmpty(oldToNext)) {
|
|
|
|
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, last_modify_time: Sequelize.fn('NOW') }, { where: { hotel_id: oldToNext },logging: false, });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
return {
|
|
|
@ -400,12 +400,12 @@ class Heytrip {
|
|
|
|
if (!isEmpty(offInfo)) {
|
|
|
|
if (!isEmpty(offInfo)) {
|
|
|
|
const flag = Number(lgcObj.lgc) === 1 ? 2 : 99; // 等待获取中文数据
|
|
|
|
const flag = Number(lgcObj.lgc) === 1 ? 2 : 99; // 等待获取中文数据
|
|
|
|
const priority = Number(lgcObj.lgc) === 1 ? 10 : 99;
|
|
|
|
const priority = Number(lgcObj.lgc) === 1 ? 10 : 99;
|
|
|
|
await HeytripIds.update({ update_flag: flag, priority }, { where: { hotel_id: offInfo }, ...sequelizeOptions });
|
|
|
|
await HeytripIds.update({ update_flag: flag, priority, last_modify_time: Sequelize.fn('NOW') }, { where: { hotel_id: offInfo }, ...sequelizeOptions });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const updateInfo = insertData.info.filter((iitem) => existsIds.includes(`${iitem.hotel_id}`));
|
|
|
|
const updateInfo = insertData.info.filter((iitem) => existsIds.includes(`${iitem.hotel_id}`));
|
|
|
|
if (!isEmpty(updateInfo)) {
|
|
|
|
if (!isEmpty(updateInfo)) {
|
|
|
|
await HeytripIds.update({ update_flag: 0, priority: 0 }, { where: { hotel_id: updateInfo.map((x) => x.hotel_id) }, ...sequelizeOptions });
|
|
|
|
await HeytripIds.update({ update_flag: 0, priority: 0, last_modify_time: Sequelize.fn('NOW') }, { where: { hotel_id: updateInfo.map((x) => x.hotel_id) }, ...sequelizeOptions });
|
|
|
|
for await (const updateRow of updateInfo) {
|
|
|
|
for await (const updateRow of updateInfo) {
|
|
|
|
// 有中英文的, 把名称合并, eg.上海意家人酒店Yijiaren Hotel
|
|
|
|
// 有中英文的, 把名称合并, eg.上海意家人酒店Yijiaren Hotel
|
|
|
|
const _BaseName = _BaseInfoExistsMapped[`${updateRow.hotel_id}`].hotel_name;
|
|
|
|
const _BaseName = _BaseInfoExistsMapped[`${updateRow.hotel_id}`].hotel_name;
|
|
|
@ -439,8 +439,8 @@ class Heytrip {
|
|
|
|
if (!isEmpty(insertData.reviews_summaries)) await ReviewsSummaries.bulkCreate(insertData.reviews_summaries, sequelizeOptions);
|
|
|
|
if (!isEmpty(insertData.reviews_summaries)) await ReviewsSummaries.bulkCreate(insertData.reviews_summaries, sequelizeOptions);
|
|
|
|
if (!isEmpty(insertData.locations)) await Locations.bulkCreate(insertData.locations, sequelizeOptions);
|
|
|
|
if (!isEmpty(insertData.locations)) await Locations.bulkCreate(insertData.locations, sequelizeOptions);
|
|
|
|
|
|
|
|
|
|
|
|
if (!isEmpty(newInfo)) await HeytripIds.update({ update_flag: 0, priority: 0 }, { where: { hotel_id: newInfo.map((x) => x.hotel_id) }, ...sequelizeOptions });
|
|
|
|
if (!isEmpty(newInfo)) await HeytripIds.update({ update_flag: 0, priority: 0, last_modify_time: Sequelize.fn('NOW') }, { where: { hotel_id: newInfo.map((x) => x.hotel_id) }, ...sequelizeOptions });
|
|
|
|
if (!isEmpty(updateInfo)) await HeytripIds.update({ update_flag: 0, priority: 0 }, { where: { hotel_id: updateInfo.map((x) => x.hotel_id) }, ...sequelizeOptions });
|
|
|
|
if (!isEmpty(updateInfo)) await HeytripIds.update({ update_flag: 0, priority: 0, last_modify_time: Sequelize.fn('NOW') }, { where: { hotel_id: updateInfo.map((x) => x.hotel_id) }, ...sequelizeOptions });
|
|
|
|
|
|
|
|
|
|
|
|
return Info;
|
|
|
|
return Info;
|
|
|
|
});
|
|
|
|
});
|
|
|
|