Commit b4cf11b2 authored by 李尚科's avatar 李尚科
parents 529d6852 92d0cc20
Pipeline #6515 passed with stage
in 4 seconds
......@@ -24,12 +24,7 @@ class NewHouseController extends Controller {
};
ctx.validate(rule, inputParams);
let ret = {};
// if (inputParams.hasOwnProperty('type') && inputParams.type !== '') {
// ret = await ctx.service.house.newHouse.getNewHouseListByType(inputParams);
// } else {
// ret = await ctx.service.house.newHouse.getNewHouseList(inputParams);
// }
ret = await ctx.service.house.newHouse.getNewHouseListV2(inputParams);
ret = await ctx.service.house.newHouse.getNewHouseList(inputParams);
ctx.success(ret);
}
......
......@@ -115,7 +115,7 @@ class NewHouseService extends Service {
for (let i in developerinfo) {
developer.push(developerinfo[i].developer.name);
}
//将json格式字符串处理
let nearBy = '';
if (data.residential.nearBy.length > 0) {
let temp = eval(data.residential.nearBy);
......@@ -127,6 +127,19 @@ class NewHouseService extends Service {
nearBy += subTemp + ';';
}
}
//房型面积处理
let newHouseTypeList = data.newHouseType;
let typeArea = {
min: 0,
max: 0
};
if (newHouseTypeList.length > 0) {
for (let i in newHouseTypeList) {
typeArea.min = typeArea.min === 0 ? newHouseTypeList[i].area : (newHouseTypeList[i].area < typeArea.min ? newHouseTypeList[i].area : typeArea.min);
typeArea.max = typeArea.max === 0 ? newHouseTypeList[i].area : (newHouseTypeList[i].area > typeArea.max ? newHouseTypeList[i].area : typeArea.max);
}
}
let area = typeArea.min === typeArea.max ? typeArea.min : typeArea.min + '-' + typeArea.max;
ret.basic = {
id: data.id,
name: data.name,//标题
......@@ -141,7 +154,7 @@ class NewHouseService extends Service {
ret.info = {
open_date: data.openDate,//开盘时间
due_date: data.dueDate,//交房时间
house_area: data.houseArea,//建筑面积
house_area: area,//建筑面积
decoration: decorationType[data.decorationType] || '',//装修情况,1 毛坯,2简装,3精装
green_ratio: data.greenRatio,//绿化
area_ratio: data.areaRatio,//容积
......@@ -270,7 +283,7 @@ class NewHouseService extends Service {
}
async getNewHouseListV2(condition) {
async getNewHouseList(condition) {
const { ctx, service } = this;
let types = ['all', 'sale', 'open', 'favourable', 'home'];
let type = (condition.hasOwnProperty('type') && types.includes(condition.type)) ? condition.type : '';
......@@ -369,16 +382,11 @@ class NewHouseService extends Service {
if (condition.area && condition.area.hasOwnProperty('min') && condition.area.hasOwnProperty('max')) {//面积
filter.queryConditions.push(
{
key: 'houseArea',
value: condition.area.min,
operator: 'greaterEqual',
key: 'area',
value: condition.area.min + ',' + condition.area.max,
operator: 'between',
},
{
key: 'houseArea',
value: condition.area.max,
operator: 'lessEqual',
})
;
);
}
if (condition.house_type) {//户型
filter.queryConditions.push({
......
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