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,