Commit fca7f676 authored by Hsinli's avatar Hsinli

addd

parent 2a2ad86f
Pipeline #10330 passed with stage
in 17 seconds
...@@ -135,38 +135,28 @@ class FootPrintService extends Service { ...@@ -135,38 +135,28 @@ class FootPrintService extends Service {
const list = await ctx.realestateModel.FootPrint.all(filter); const list = await ctx.realestateModel.FootPrint.all(filter);
let count = 0; let count = 0;
if (list.length > 0) { if (list.length > 0) {
let newHouseId = []; let taskList = [];
let rentalHouseId = []; let taskFilter = {
where: {
status: 'online',
valid: 1,
id: list[i].connect_id
}
}
for (let i in list) { for (let i in list) {
if (Number(list[i].house_style) === 1) { if (Number(list[i].house_style) === 1) {
newHouseId.push(list[i].connect_id); taskList[i] = ctx.realestateModel.NewHouse.one(taskFilter);
} }
if (Number(list[i].house_style) === 2) { if (Number(list[i].house_style) === 2) {
rentalHouseId.push(list[i].connect_id); taskList[i] = ctx.realestateModel.RentalHouse.one(taskFilter);
} }
} }
let newHousefilter = { const retList = await Promise.all(taskList).then(result => {
where: {
status: 'online',
valid: 1,
id: { $in: newHouseId },
},
}
let newHouseCountTask = ctx.realestateModel.NewHouse.count(newHousefilter);
let rentalHousefilter = {
where: {
status: 'online',
valid: 1,
id: { $in: rentalHouseId },
},
}
let rentalHouseCountTask = ctx.realestateModel.RentalHouse.count(rentalHousefilter);
const retList = await Promise.all([newHouseCountTask, rentalHouseCountTask]).then(result => {
return result; return result;
}).catch(error => { }).catch(error => {
ctx.failed(error); ctx.failed(error);
}); });
count = Number(retList[0]) + Number(retList[1]); count = Number(retList.length);
} }
let ret = { let ret = {
count: count count: count
......
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