Commit b2eca23e authored by Hsinli's avatar Hsinli

fix

parent 9f8af8aa
Pipeline #9262 passed with stage
in 18 seconds
...@@ -133,6 +133,9 @@ class CollectionService extends Service { ...@@ -133,6 +133,9 @@ class CollectionService extends Service {
}); });
//数据整理 //数据整理
for (let j in retList) { for (let j in retList) {
if (retList[j].status === 'offline' || Number(retList[j].valid) === 0) {
continue;
}
let type = collectionList[j].house_style; let type = collectionList[j].house_style;
let tmp = { let tmp = {
id: retList[j].id, id: retList[j].id,
...@@ -166,8 +169,7 @@ class CollectionService extends Service { ...@@ -166,8 +169,7 @@ class CollectionService extends Service {
} }
let endDate = moment().subtract(6, 'months').format('YYYY-MM-DD HH:mm:ss'); let endDate = moment().subtract(6, 'months').format('YYYY-MM-DD HH:mm:ss');
let filter = { let filter = {
page: 1, attributes: ['connect_id', 'house_style'],
limit: 50,
where: { where: {
state: 1, state: 1,
user_id: ctx.userId, user_id: ctx.userId,
...@@ -176,8 +178,43 @@ class CollectionService extends Service { ...@@ -176,8 +178,43 @@ class CollectionService extends Service {
order: [['created_at', 'desc']] order: [['created_at', 'desc']]
} }
let collectionList = await ctx.realestateModel.Collection.all(filter); let collectionList = await ctx.realestateModel.Collection.all(filter);
let count = 0;
if (collectionList.length > 0) {
let newHouseId = [];
let rentalHouseId = [];
for (let i in collectionList) {
if (Number(collectionList[i].house_style) === 1) {
newHouseId.push(collectionList[i].connect_id);
}
if (Number(collectionList[i].house_style) === 2) {
rentalHouseId.push(collectionList[i].connect_id);
}
}
let newHousefilter = {
where: {
status: 'online',
valid: 1,
id: { $in: newHouseId },
},
}
let newHouseCountTask = ctx.realestateModel.NewHouse.count(newHousefilter);
let rentalHousefilter = {
where: {
status: 'online',
valid: 1,
id: { $in: newHouseId },
},
}
let rentalHouseCountTask = ctx.realestateModel.RentalHouse.count(rentalHousefilter);
const retList = await Promise.all([newHouseCountTask, rentalHouseCountTask]).then(result => {
return result;
}).catch(error => {
ctx.failed(error);
});
count = Number(retList[0]) + Number(retList[1]);
}
let ret = { let ret = {
count: collectionList.length count: count
}; };
return ret; return ret;
} }
......
...@@ -73,6 +73,9 @@ class FootPrintService extends Service { ...@@ -73,6 +73,9 @@ class FootPrintService extends Service {
//处理足迹数据 //处理足迹数据
const foot_print_records = []; const foot_print_records = [];
for (let j in houses) { for (let j in houses) {
if (retList[j].status === 'offline' || Number(retList[j].valid) === 0) {
continue;
}
const house = houses[j]; const house = houses[j];
const foot_print = foot_prints[j]; const foot_print = foot_prints[j];
const type = foot_print.house_style === 1 ? 'new_house' : 'rental_house'; const type = foot_print.house_style === 1 ? 'new_house' : 'rental_house';
......
...@@ -85,6 +85,9 @@ class OrderService extends Service { ...@@ -85,6 +85,9 @@ class OrderService extends Service {
}); });
//数据整理 //数据整理
for (let j in retList) { for (let j in retList) {
if (retList[j].status === 'offline' || Number(retList[j].valid) === 0) {
continue;
}
let type = orderList[j].house_style; let type = orderList[j].house_style;
let tmp = { let tmp = {
id: retList[j].id, id: retList[j].id,
......
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