Commit c13fb0b3 authored by 李尚科's avatar 李尚科

house developer option fix

parent 842d8920
Pipeline #7122 passed with stage
in 9 seconds
...@@ -8,6 +8,9 @@ class RentalHouseController extends Controller { ...@@ -8,6 +8,9 @@ class RentalHouseController extends Controller {
async home() { async home() {
const { ctx } = this; const { ctx } = this;
const input_params = ctx.query;
const city_code = input_params.city_code ? input_params.city_code : 330100;
//banners //banners
const app_user_id = ctx.appUserId; const app_user_id = ctx.appUserId;
const user_id = ctx.userId; const user_id = ctx.userId;
...@@ -24,12 +27,12 @@ class RentalHouseController extends Controller { ...@@ -24,12 +27,12 @@ class RentalHouseController extends Controller {
cookie: ctx.request.headers.cookie cookie: ctx.request.headers.cookie
} }
// house_h5_rental_home_banners // house_h5_rental_home_banners
const banners_result = await ctx.helper.send_request(this.config.NODE_BASE_URL + '/51app/api/block/all', { alias: '51fangc_rental_home_banners' }, { method: 'GET', dataType: 'json', headers: headers}); const banners_result = await ctx.helper.send_request(this.config.NODE_BASE_URL + '/51app/api/block/all', { alias: '51fangc_rental_home_banners' }, { method: 'GET', dataType: 'json', headers: headers });
let banners = []; let banners = [];
if (banners_result.status === 200) { if (banners_result.status === 200) {
banners = banners_result.data.results; banners = banners_result.data.results;
} }
const developers = await ctx.service.house.option.getDevelopers();//品牌信息 const developers = await ctx.service.house.option.getDevelopers(city_code);//品牌信息
ctx.success({ banners, developers }); ctx.success({ banners, developers });
} }
...@@ -49,7 +52,7 @@ class RentalHouseController extends Controller { ...@@ -49,7 +52,7 @@ class RentalHouseController extends Controller {
}; };
ctx.validate(rule, input_params); ctx.validate(rule, input_params);
const ret = await ctx.service.house.rentalHouse.getRentalHousesByFilter(input_params); const ret = await ctx.service.house.rentalHouse.getRentalHousesByFilter(input_params);
ctx.success({input_params, results: ret.results, count: ret.count }); ctx.success({ input_params, results: ret.results, count: ret.count });
} }
//租房详情 //租房详情
......
...@@ -68,7 +68,7 @@ class OptionService extends Service { ...@@ -68,7 +68,7 @@ class OptionService extends Service {
//获取筛选项 //获取筛选项
async getOptions(city_code) { async getOptions(city_code) {
const brands = await this.getDevelopers(); const brands = await this.getDevelopers(city_code);
const house_types = HOUSE_TYPE; const house_types = HOUSE_TYPE;
const prices = PRICE_RANGE; const prices = PRICE_RANGE;
const areas = await this.getAreaOptions(city_code); const areas = await this.getAreaOptions(city_code);
...@@ -107,20 +107,31 @@ class OptionService extends Service { ...@@ -107,20 +107,31 @@ class OptionService extends Service {
} }
//获取开发商列表 //获取开发商列表
async getDevelopers() { async getDevelopers(city_code) {
const { ctx } = this; const { ctx } = this;
const developers_results = await ctx.service.houseCommon.developer.all({}); const developers_results = await ctx.service.houseCommon.developer.all({});
const developers = developers_results.results; const developers = developers_results.results;
const ret = []; const ret = [];
city_code = city_code ? parseInt(city_code) : 330100;
for (let i in developers) { for (let i in developers) {
const developer = developers[i]; const developer = developers[i];
ret.push({ if (city_code === 330100 && developer.id === 2) {
id: developer.id, ret.push({
name: developer.name, id: developer.id,
image: developer.logo, name: developer.name,
value: developer.id, image: developer.logo,
}); value: developer.id,
});
}
if (city_code === 500000 && developer.id === 1) {
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