let arr_ = [];
async.eachSeries(data_.data,(index,next)=>{
let obj__ = {};
let provider_number = index[0];
let provider_name = index[1];
let provider_region = index[2];
let provider_contact = index[3];
let provider_remark = index[4];
let url = http://restapi.amap.com/v3/geocode/geo?key=96538813cf6ed27bfa368eefbdb6f49d&address=${provider_region}
;
request(url,function(error,response,body){
if(!error && response.statusCode == 200){
//输出返回的内容
// JSON.stringify(body)
// console.log(JSON.parse(body))
// console.log(body.geocodes)
// res.send(body);
// return
console.log(‘aaaaa’)
}
});
obj__.company_id = company_id;
obj__.provider_id = provider_id;
obj__.create_time = new Date().getTime();
obj__.provider_number = provider_number;
obj__.provider_name = provider_name;
obj__.provider_remark = provider_remark;
obj__.provider_defined = ‘’;
obj__.provider_state = {
state_name: ‘启用’,
state_value: ‘1’
}
obj__.provider_region = ‘’;
obj__.provider_contact = provider_contact;
arr_.push(obj__);
},callback)
res.send(arr_);
这打印出来的console 就出来一次。。。好郁闷啊 我的业务逻辑是 我现在需要批量插入数据,每一个数据都有一个地址,我现在我需要把每个地址用高德地图里面的API转化为code码,然后赋值给一个对象的一个字段,再把对象push 到数组中最后数组批量插入,哎 新手 弄一天了 还是不行