Browse Source

七牛参数

release_0.0.1
巴林闲侠 2 years ago
parent
commit
904152a32e
  1. 20
      api/config.js
  2. BIN
      scripts/0.0.1/data/3_init_report_pic_data/data/养护内容.xlsx
  3. 12
      scripts/0.0.1/data/3_init_report_pic_data/index.js

20
api/config.js

@ -21,12 +21,12 @@ args.option('qndmn', 'qiniuDomain');
const flags = args.parse(process.argv); const flags = args.parse(process.argv);
const FS_UNIAPP_DB = process.env.FS_UNIAPP_DB || flags.pg; const FS_UNIAPP_DB = process.env.FS_UNIAPP_DB || flags.pg;
const LOCAL_SVR_ORIGIN = process.env.LOCAL_SVR_ORIGIN || flags.fileHost; // const LOCAL_SVR_ORIGIN = process.env.LOCAL_SVR_ORIGIN || flags.fileHost;
const QINIU_DOMAIN_QNDMN_RESOURCE = process.env.QINIU_DOMAIN_QNDMN_RESOURCE || flags.qndmn; const QINIU_DOMAIN_QNDMN_RESOURCE = process.env.ANXINCLOUD_QINIU_DOMAIN_QNDMN_RESOURC || flags.qndmn;
const QINIU_BUCKET_RESOURCE = process.env.QINIU_BUCKET_RESOURCE || flags.qnbkt; const QINIU_BUCKET_RESOURCE = process.env.ANXINCLOUD_QINIU_BUCKET_RESOURCE || flags.qnbkt;
const QINIU_AK = process.env.QINIU_AK || flags.qnak; const QINIU_AK = process.env.ANXINCLOUD_QINIU_ACCESSKEY || flags.qnak;
const QINIU_SK = process.env.QINIU_SK || flags.qnsk; const QINIU_SK = process.env.ANXINCLOUD_QINIU_SECRETKEY || flags.qnsk;
if (!FS_UNIAPP_DB) { if (!FS_UNIAPP_DB) {
console.log('缺少启动参数,异常退出'); console.log('缺少启动参数,异常退出');
@ -41,11 +41,11 @@ const product = {
{ {
entry: require('@fs/attachment').entry, entry: require('@fs/attachment').entry,
opts: { opts: {
local: { // local: {
origin: LOCAL_SVR_ORIGIN || `http://localhost:${flags.port || 8080}`, // origin: LOCAL_SVR_ORIGIN || `http://localhost:${flags.port || 8080}`,
rootPath: 'static', // rootPath: 'static',
childPath: 'upload', // childPath: 'upload',
}, // },
qiniu: { qiniu: {
domain: QINIU_DOMAIN_QNDMN_RESOURCE, domain: QINIU_DOMAIN_QNDMN_RESOURCE,
bucket: QINIU_BUCKET_RESOURCE, bucket: QINIU_BUCKET_RESOURCE,

BIN
scripts/0.0.1/data/3_init_report_pic_data/data/养护内容.xlsx

Binary file not shown.

12
scripts/0.0.1/data/3_init_report_pic_data/index.js

@ -59,7 +59,7 @@ try {
if (respInfo.statusCode == 200) { if (respInfo.statusCode == 200) {
console.log(respBody); console.log(respBody);
let qnkey = respBody.key; let qnkey = respBody.key;
resolve({ key: qnkey, url: `/${qnkey}` }); resolve({ key: qnkey, url: `${qnkey}` });
} else { } else {
console.log(respInfo.statusCode); console.log(respInfo.statusCode);
console.log(respBody); console.log(respBody);
@ -102,10 +102,16 @@ try {
}) })
console.log(picList); console.log(picList);
// 将图片上传至 7niu // 将图片上传至 7niu
let upPicUrl = [];
for (let p of picList) { 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') // await client.query('ROLLBACK')

Loading…
Cancel
Save