perf: 搜索酒店增加图片

main
Lei OT 10 months ago
parent e12bb672a3
commit bb0b582381

@ -40,6 +40,7 @@ Hotelinfo.hasMany(Hotelinfo2, { as: 'locale_info', sourceKey: 'hotel_id', foreig
// Hotelinfo2.belongsTo(Hotelinfo, { as: 'locale_info2', targetKey: 'hotel_id', foreignKey: 'hotel_id', ...foreignOption, });
Hotelinfo.hasOne(City, { as: 'city', sourceKey: 'city_id', foreignKey: 'id', ...foreignOption, }); // 多语种, 所以实际是 hasMany , 用 hasOne 要指定 lgc= 1 或者2
Hotelinfo.hasOne(Country, { as: 'country', sourceKey: 'country_code', foreignKey: 'id', ...foreignOption, }); // 多语种, 所以实际是 hasMany , 用 hasOne 要指定 lgc= 1 或者2
Hotelinfo.hasMany(Images, { sourceKey: 'hotel_id', foreignKey: 'hotel_id', ...foreignOption });
Rooms.hasMany(Images, { sourceKey: 'room_id', foreignKey: 'info_source_id', ...foreignOption });
@ -86,8 +87,16 @@ 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
{
model: Images,
attributes: { exclude: ['lgc', 'locale'] },
where: { lgc: [0, 1], type: Sequelize.where(Sequelize.fn('IFNULL', Sequelize.col('type'), 'Mid'), 'Mid') },
order: ['info_source'],
required: false,
separate: true,
}, // separate: true
],
where: {
[Op.or]: keywordSearch,

Loading…
Cancel
Save