Commit 2115e0c2 authored by 李尚科's avatar 李尚科

options fix

parent ab52da41
Pipeline #8672 passed with stage
in 4 seconds
...@@ -11,7 +11,7 @@ module.exports = app => { ...@@ -11,7 +11,7 @@ module.exports = app => {
primaryKey: true, primaryKey: true,
autoIncrement: true, autoIncrement: true,
}, },
address: { short_name: {
type: STRING, type: STRING,
allowNull: true allowNull: true
}, },
......
...@@ -52,7 +52,7 @@ module.exports = app => { ...@@ -52,7 +52,7 @@ module.exports = app => {
router.get('/v2/rental_house/list', 'house.v2.rentalHouse.getRentalHouses');//租房列表 router.get('/v2/rental_house/list', 'house.v2.rentalHouse.getRentalHouses');//租房列表
router.post('/v2/rental_house/list', 'house.v2.rentalHouse.getRentalHouses');//租房列表 router.post('/v2/rental_house/list', 'house.v2.rentalHouse.getRentalHouses');//租房列表
router.get('/v2/rental_house/info/:rental_house_id', 'house.v2.rentalHouse.getRentalHouse');//住房详情 router.get('/v2/rental_house/info/:rental_house_id', 'house.v2.rentalHouse.getRentalHouse');//住房详情
router.get('/v2/options/:city_code', 'house.v2.options.getOptions');//筛选项信息 router.get('add', '/v2/options/:city_code', 'house.v2.options.getOptions');//筛选项信息
//足迹 //足迹
router.get('/v2/foot_print/list', 'house.v2.footPrint.getFootPrintList');//用户浏览记录列表 router.get('/v2/foot_print/list', 'house.v2.footPrint.getFootPrintList');//用户浏览记录列表
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
'use strict'; 'use strict';
const Service = require('egg').Service; const Service = require('egg').Service;
const R = require('ramda');
const PRICE_RANGE = [ const PRICE_RANGE = [
{ name: '不限', id: -100, min: 0, max: 0 }, { name: '不限', id: -100, min: 0, max: 0 },
{ name: '2000元以下', id: -101, min: 0, max: 2000 }, { name: '2000元以下', id: -101, min: 0, max: 2000 },
...@@ -79,7 +79,8 @@ class OptionService extends Service { ...@@ -79,7 +79,8 @@ class OptionService extends Service {
{ name: '品牌', id: -1, path: [], nameShow: '', _children: brands }, { name: '品牌', id: -1, path: [], nameShow: '', _children: brands },
{ name: '区域', id: -2, path: [], nameShow: '', _children: areas }, { name: '区域', id: -2, path: [], nameShow: '', _children: areas },
{ name: '价格', id: -3, path: [], nameShow: '', _children: prices }, { name: '价格', id: -3, path: [], nameShow: '', _children: prices },
{ name: '户型', id: -4, path: [], nameShow: '', _children: house_types }] { name: '户型', id: -4, path: [], nameShow: '', _children: house_types }
]
}; };
} }
...@@ -111,43 +112,10 @@ class OptionService extends Service { ...@@ -111,43 +112,10 @@ class OptionService extends Service {
async getDevelopers(city_code) { async getDevelopers(city_code) {
const { ctx } = this; const { ctx } = this;
const developers_results = await ctx.service.houseCommon.developer.all({}); const rental_house_developers = await ctx.realestateModel.RentalHouse.findAll({ attributes: ['developer_id'], group: 'developer_id', where: { option_city_code: city_code } });
const developers = developers_results.results; const developers_ids = rental_house_developers.map(item => { return item.dataValues.developer_id });
const ret = []; const developers = await ctx.realestateModel.Developer.all({ where: { id: { $in: developers_ids } } });
city_code = city_code ? parseInt(city_code) : 330100; const ret = developers.map(item => { return { id: item.id, name: item.name, image: item.logo, value: item.id } });
const setting_ret = await ctx.blockModel.Setting.one({ where: { keyword: 'config_fangc_developers' } });
const setting_value = ctx.helper.JsonParse(setting_ret.value);
for (let i in developers) {
const developer = developers[i];
if (setting_value && setting_value[city_code]) {
const setting_developers = setting_value[city_code];
if (setting_developers.includes(developer.id)) {
ret.push({
id: developer.id,
name: developer.name,
image: developer.logo,
value: developer.id,
});
}
}
// if (city_code === 330100 && [2, 4, 5, 6, 7].includes(developer.id)) {
// ret.push({
// id: developer.id,
// name: developer.name,
// image: developer.logo,
// value: developer.id,
// });
// }
// if (city_code === 500000 && [1, 3].includes(developer.id)) {
// ret.push({
// id: developer.id,
// name: developer.name,
// image: developer.logo,
// value: developer.id,
// });
// }
}
return ret; return ret;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment