|
|
@ -59,7 +59,7 @@ try { |
|
|
|
if (respInfo.statusCode == 200) { |
|
|
|
console.log(respBody); |
|
|
|
let qnkey = respBody.key; |
|
|
|
resolve({ key: qnkey, url: `/${qnkey}` }); |
|
|
|
resolve({ key: qnkey, url: `${qnkey}` }); |
|
|
|
} else { |
|
|
|
console.log(respInfo.statusCode); |
|
|
|
console.log(respBody); |
|
|
@ -102,10 +102,16 @@ try { |
|
|
|
}) |
|
|
|
console.log(picList); |
|
|
|
// 将图片上传至 7niu
|
|
|
|
let upPicUrl = []; |
|
|
|
for (let p of picList) { |
|
|
|
await upload7niu(path.join(__dirname, p.path), p.name) |
|
|
|
const upRes = await upload7niu(path.join(__dirname, p.path), p.name) |
|
|
|
console.log(upRes); |
|
|
|
upPicUrl.push(upRes.url) |
|
|
|
} |
|
|
|
break |
|
|
|
const roadSectionArr = r['路段'] ? r['路段'].split('至') : null |
|
|
|
const roadSection = roadSectionArr && roadSectionArr.length > 1 ? roadSectionArr : [null, null] |
|
|
|
await client.query(`INSERT INTO report (report_type, project_type, road, road_section_start, road_section_end,time,content,conserve_underway_pic) VALUES($1, $2, $3, $4, $5, $6, $7, $8) `, ['conserve', 'road', r['道路'], roadSection[0], roadSection[1], r['时间'], r['内容'], upPicUrl]) |
|
|
|
// break
|
|
|
|
} |
|
|
|
|
|
|
|
// await client.query('ROLLBACK')
|
|
|
|