Commit 1265ec50 authored by Hsinli's avatar Hsinli

add

parent 769dc2b9
Pipeline #5895 passed with stage
in 2 seconds
......@@ -52,6 +52,49 @@ class CollectionService extends Service {
return { id: ret.id };
}
/**
* 获取用户关注信息
* @param {object} inputParams
*/
async getCollection(inputParams) {
const { ctx, service } = this;
if (!inputParams.hasOwnProperty('type')) {
ctx.failed("empty house type");
}
if (!inputParams.hasOwnProperty('id')) {
ctx.failed("empty house id");
}
// if (!ctx.userId) {
// return [];
// }
// let userId = ctx.userId;
let userId = '33A54829-1262-40B5-BE36-B57A12DA090B';
let filter = {
pageIndex: 1,
pageSize: 999,
queryConditions: [{
key: "state",
value: '1',
operator: "equal"
}, {
key: "houseStyle",
value: inputParams.type,
operator: "equal"
}, {
key: "connectId",
value: inputParams.id,
operator: "equal"
}, {
key: "userId",
value: userId,
operator: "equal"
}],
orderConditions: [],
}
let ret = await service.houseCommon.collection.all(filter);
return ret;
}
/**
* 获取收藏列表 保留最近6个月的记录,条数不超过50条
......@@ -90,7 +133,7 @@ class CollectionService extends Service {
//整理所有收藏
let taskList = [];
for (let i in collectionList.results) {
if (collectionList.results[i].houseStyle === 1) {
if (collectionList.results[i].houseStyle === 1) {//1新房2租房 后续根据情况添加
taskList[i] = service.houseCommon.newHouse.one(collectionList.results[i].connectId);
} else {
taskList[i] = service.houseCommon.rentalHouse.one(collectionList.results[i].connectId);
......
......@@ -114,12 +114,15 @@ class NewHouseService extends Service {
}
//户型信息
let newHouseType = await this.getNewHouseType(id);
//是否关注
let collectionFilter = { type: 1, id: id }
let collection = await service.house.collection.getCollection(collectionFilter);
let ret = {
house_basic: newHouseFormat,
house_images: images,
house_types: newHouseType
house_types: newHouseType,
collection: collection.rowCount > 0 ? true : false,
}
//TODO对数据格式化处理
return ret;
}
......@@ -137,14 +140,14 @@ class NewHouseService extends Service {
favourable_info: data.favourableInfo,//优惠
reference_avg_price: data.referenceAvgPrice,//均价
reference_total_price: data.referenceTotalPrice,//总价
//物业类型
property_type: '',//物业类型
}
ret.info = {
open_date: data.openDate,//开盘时间
due_date: data.dueDate,//交房时间
house_area: data.houseArea,//建筑面积
//装修情况
decoration: '',//装修情况
green_ratio: data.greenRatio,//绿化
area_ratio: data.areaRatio,//容积
address: data.address,//地址
......@@ -153,22 +156,22 @@ class NewHouseService extends Service {
basic: {
reference_avg_price: data.referenceAvgPrice,//均价
tags: data.tags.split(','),//项目特色
//物业类型
property_type: '',//物业类型
property_right_years: residentialInfo.propertyRightYears || '',//产权年限
//建筑类型
//装修情况
build_type: '',//建筑类型
decoration: '',//装修情况
},
sale: {
//销售状态
sale_type: '',//销售状态
address: data.address,//地址
//售楼地址
//开发商
sale_address: '',//售楼地址
developer: '',//开发商
open_date: data.openDate,//开盘时间
due_date: data.dueDate,//交房时间
},
residential: {
//占地面积
//建筑面积
land_area: '',//占地面积
house_area: '',//建筑面积
area_ratio: data.areaRatio,//容积率
green_ratio: data.greenRatio,//绿化率
property_fee: residentialInfo.PropertyFee || '',//物业费用
......@@ -226,6 +229,7 @@ class NewHouseService extends Service {
});
}
//将楼盘的户型按照户型分组
let typeFormat = {};
for (let i in retList) {
let type = retList[i].type;
......@@ -239,13 +243,18 @@ class NewHouseService extends Service {
typeFormat[type].results.push(retList[i]);
typeFormat[type].count++;
}
let classification = [];
for (let i in typeFormat) {
classification.push(typeFormat[i]);
}
let ret = {
all: {
results: retList,
count: retList.length
}
},
classification: classification
};
Object.assign(ret, typeFormat);
return ret;
}
......@@ -270,7 +279,7 @@ class NewHouseService extends Service {
num: data.num,//房源数量
price: data.price,//价格
discount: data.discount,//折扣
// tag: data.tags.split(','),//特点
tag: data.tags ? data.tags.split(',') : ['好', '真好'],//特点
}
}
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