From 06c6c2506b872fe36c077bbf48ad2104b7fe1ad9 Mon Sep 17 00:00:00 2001 From: Lei OT Date: Mon, 26 Aug 2024 13:50:06 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E9=85=92=E5=BA=97=E6=90=9C=E7=B4=A2:?= =?UTF-8?q?=20=E5=9F=8E=E5=B8=82,=20=E5=9B=BD=E5=AE=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/services/heytripService.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/services/heytripService.js b/server/services/heytripService.js index 7a73fa0..b6fe6f2 100644 --- a/server/services/heytripService.js +++ b/server/services/heytripService.js @@ -38,8 +38,8 @@ const Logs = models.requestLogsModel; Hotelinfo.belongsTo(HeytripIds, { as: 'aid', foreignKey: 'hotel_id', onDelete: 'NO ACTION', onUpdate: 'NO ACTION' }); Hotelinfo.hasMany(Hotelinfo2, { as: 'locale_info', sourceKey: 'hotel_id', foreignKey: 'hotel_id', onDelete: 'NO ACTION', onUpdate: 'NO ACTION' }); // Hotelinfo2.belongsTo(Hotelinfo, { as: 'locale_info2', targetKey: 'hotel_id', foreignKey: 'hotel_id', onDelete: 'NO ACTION', onUpdate: 'NO ACTION', }); -Hotelinfo.hasMany(City, { as: 'city', sourceKey: 'city_id', foreignKey: 'id', onDelete: 'NO ACTION', onUpdate: 'NO ACTION', }); // 多语种, 所以实际是 hasMany , 用 hasOne 要指定 lgc= 1 或者2 -Hotelinfo.hasMany(Country, { as: 'country', sourceKey: 'country_code', foreignKey: 'id', onDelete: 'NO ACTION', onUpdate: 'NO ACTION', }); // 多语种, 所以实际是 hasMany , 用 hasOne 要指定 lgc= 1 或者2 +Hotelinfo.hasOne(City, { as: 'city', sourceKey: 'city_id', foreignKey: 'id', onDelete: 'NO ACTION', onUpdate: 'NO ACTION', }); // 多语种, 所以实际是 hasMany , 用 hasOne 要指定 lgc= 1 或者2 +Hotelinfo.hasOne(Country, { as: 'country', sourceKey: 'country_code', foreignKey: 'id', onDelete: 'NO ACTION', onUpdate: 'NO ACTION', }); // 多语种, 所以实际是 hasMany , 用 hasOne 要指定 lgc= 1 或者2 class Heytrip { /** @@ -84,8 +84,8 @@ class Heytrip { required: false, separate: true, }, - { model: City, as: 'city', attributes: ['id', 'name'], where: { lgc: 2 }, required: false, separate: true }, - { model: Country, as: 'country', attributes: ['id', 'name'], where: { lgc: 2 }, required: false, separate: true }, + { model: City, as: 'city', attributes: ['id', 'name'], where: { lgc: 2 }, required: false, }, // separate: true + { model: Country, as: 'country', attributes: ['id', 'name'], where: { lgc: 2 }, required: false, }, // separate: true ], where: { [Op.or]: keywordSearch,