Commit e593c953 authored by 李尚科's avatar 李尚科
parents 89212f9c 49ebfb07
Pipeline #9237 passed with stage
in 17 seconds
......@@ -22,13 +22,15 @@ class Export20190425 extends Controller {
let newHouseList = retList.data;
let ret = {
new_org_count: newHouseList.rowCount,
new_house: [],
new_house_type: [],
new_data: [],
type_data: [],
};
if (newHouseList.rowCount > 0) {
let list = newHouseList.results;
let newHouseData = [];
for (let i in list) {
let newHouseData = {
newHouseData[i] = {
// id: list[i].id,
name: list[i].name,
residential_id: list[i].residentialId,
// developer_id: list[i].xxx,
......@@ -84,14 +86,13 @@ class Export20190425 extends Controller {
residential_arch_type: list[i].residential.archType,
residential_nearby: list[i].residential.nearBy,
}
//房源信息和小区信息
let id = await ctx.realestateModel.NewHouse.add(newHouseData);
ret.new_house.push(id);
//户型
if (list[i].newHouseType.length > 0) {
let newHouseType = list[i].newHouseType;
let newHouseDataTypeData = [];
for (let j in newHouseType) {
let newHouseDataTypeData = {
newHouseDataTypeData[j] = {
new_house_id: newHouseType[j].newHouseId,
type: newHouseType[j].type,
image: newHouseType[j].image,
......@@ -110,14 +111,17 @@ class Export20190425 extends Controller {
updated_at: newHouseType[j].updated_at || null,
// deleted_at: list.newHouseType[j].xxx,
}
let typeId = await ctx.realestateModel.NewHouseType.add(newHouseDataTypeData);
ret.new_house_type.push(typeId);
}
let type_data = await ctx.realestateModel.NewHouseType.bulkCreate(newHouseDataTypeData);
ret.type_data = ret.type_data.concat(type_data);
}
}
//房源信息和小区信息
let new_data = await ctx.realestateModel.NewHouse.bulkCreate(newHouseData);
ret.new_data = ret.new_data.concat(new_data);
}
ret.new_count = ret.new_house.length;
ret.type_count = ret.new_house_type.length;
ret.new_count = ret.new_data.length;
ret.type_count = ret.type_data.length;
ctx.success(ret);
}
......@@ -126,7 +130,7 @@ class Export20190425 extends Controller {
async moveCollection() {
const { ctx } = this;
let ret = {
id: [],
data: [],
};
let k = 0;
for (k = 1; k < 999; k++) {
......@@ -147,10 +151,10 @@ class Export20190425 extends Controller {
break;
}
ret.org_count = res.rowCount;
let taskList = [];
let list = res.results;
let addData = [];
for (let i in list) {
let addData = {
addData[i] = {
user_id: list[i].userId,
app_user_id: list[i].appUserId,
house_style: list[i].houseStyle,
......@@ -161,17 +165,11 @@ class Export20190425 extends Controller {
updated_at: list[i].updatedAt || null,
// deleted_at: list[i].xxx,
}
taskList[i] = ctx.realestateModel.Collection.add(addData);
}
const retList = await Promise.all(taskList).then(result => {
return result;
}).catch(error => {
ctx.failed(error);
});
ret.id = ret.id.concat(retList);
let addRes = await ctx.realestateModel.Collection.bulkCreate(addData);
ret.data = ret.data.concat(addRes);
}
ret.count = ret.id.length;
ret.count = ret.data.length;
ctx.success(ret);
}
......@@ -179,7 +177,7 @@ class Export20190425 extends Controller {
async moveOrder() {
const { ctx } = this;
let ret = {
id: [],
data: [],
};
let k = 0;
for (k = 1; k < 999; k++) {
......@@ -200,10 +198,10 @@ class Export20190425 extends Controller {
break;
}
ret.org_count = res.rowCount;
let taskList = [];
let list = res.results;
let addData = [];
for (let i in list) {
let addData = {
addData[i] = {
user_id: list[i].userId,
app_user_id: list[i].appUserId,
house_style: list[i].houseStyle,
......@@ -217,17 +215,11 @@ class Export20190425 extends Controller {
updated_at: list[i].updatedAt || null,
// deleted_at:list[i].xxx,
}
taskList[i] = ctx.realestateModel.Order.add(addData);
}
const retList = await Promise.all(taskList).then(result => {
return result;
}).catch(error => {
ctx.failed(error);
});
ret.id = ret.id.concat(retList);
let addRes = await ctx.realestateModel.Order.bulkCreate(addData);
ret.data = ret.data.concat(addRes);
}
ret.count = ret.id.length;
ret.count = ret.data.length;
ctx.success(ret);
}
......@@ -236,7 +228,7 @@ class Export20190425 extends Controller {
async moveHistory() {
const { ctx } = this;
let ret = {
id: [],
data: [],
};
let k = 0;
for (k = 1; k < 999; k++) {
......@@ -257,10 +249,10 @@ class Export20190425 extends Controller {
break;
}
ret.org_count = res.rowCount;
let taskList = [];
let list = res.results;
let addData = [];
for (let i in list) {
let addData = {
addData[i] = {
user_id: list[i].userId,
app_user_id: list[i].appUserId,
key_word: list[i].keyWord,
......@@ -270,17 +262,11 @@ class Export20190425 extends Controller {
// updated_at: list[i].xxx,
// deleted_at: list[i].xxx,
}
taskList[i] = ctx.realestateModel.SearchHistory.add(addData);
}
const retList = await Promise.all(taskList).then(result => {
return result;
}).catch(error => {
ctx.failed(error);
});
ret.id = ret.id.concat(retList);
let addRes = await ctx.realestateModel.SearchHistory.bulkCreate(addData);
ret.data = ret.data.concat(addRes);
}
ret.count = ret.id.length;
ret.count = ret.data.length;
ctx.success(ret);
}
......@@ -288,7 +274,7 @@ class Export20190425 extends Controller {
async moveFoot() {
const { ctx } = this;
let ret = {
id: [],
data: [],
};
let k = 0;
for (k = 1; k < 999; k++) {
......@@ -309,10 +295,10 @@ class Export20190425 extends Controller {
break;
}
ret.org_count = res.rowCount;
let taskList = [];
let list = res.results;
let addData = [];
for (let i in list) {
let addData = {
addData[i] = {
user_id: list[i].userId,
// app_type_id:list[i].xxx,
app_user_id: list[i].appUserId,
......@@ -324,17 +310,11 @@ class Export20190425 extends Controller {
updated_at: list[i].updatedAt || null,
// deleted_at: list[i].xxx,
}
taskList[i] = ctx.realestateModel.FootPrint.add(addData);
}
const retList = await Promise.all(taskList).then(result => {
return result;
}).catch(error => {
ctx.failed(error);
});
ret.id = ret.id.concat(retList);
let addRes = await ctx.realestateModel.FootPrint.bulkCreate(addData);
ret.data = ret.data.concat(addRes);
}
ret.count = ret.id.length;
ret.count = ret.data.length;
ctx.success(ret);
}
......
......@@ -24,10 +24,34 @@ module.exports = app => {
type: INTEGER,
allowNull: true
},
province: {
type: INTEGER,
allowNull: true
},
city: {
type: INTEGER,
allowNull: true
},
area: {
type: INTEGER,
allowNull: true
},
address: {
type: STRING,
allowNull: true
},
sale_province: {
type: INTEGER,
allowNull: true
},
sale_city: {
type: INTEGER,
allowNull: true
},
sale_area: {
type: INTEGER,
allowNull: true
},
sale_address: {
type: INTEGER,
allowNull: true
......@@ -148,18 +172,6 @@ module.exports = app => {
type: INTEGER,
allowNull: true
},
province: {
type: INTEGER,
allowNull: true
},
city: {
type: INTEGER,
allowNull: true
},
area: {
type: INTEGER,
allowNull: true
},
residential_property_right_years: {
type: INTEGER,
allowNull: true
......@@ -208,18 +220,6 @@ module.exports = app => {
type: TEXT,
allowNull: true
},
sale_province: {
type: INTEGER,
allowNull: true
},
sale_city: {
type: INTEGER,
allowNull: true
},
sale_area: {
type: INTEGER,
allowNull: true
},
deleted_at: {
type: DATE,
allowNull: true,
......
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