|
@@ -47,7 +47,7 @@ export async function toBarCode(text){
|
|
|
})
|
|
|
}
|
|
|
|
|
|
-export async function uploadFileToOSS(filePath,uniqueId){
|
|
|
+export async function uploadFileToOSS(filePath,uniqueId,fileKey){
|
|
|
uniqueId = uniqueId || ""
|
|
|
let client = new OSS({
|
|
|
// yourRegion填写Bucket所在地域。以华东1(杭州)为例,yourRegion填写为oss-cn-hangzhou。
|
|
@@ -61,7 +61,7 @@ export async function uploadFileToOSS(filePath,uniqueId){
|
|
|
|
|
|
let now = new Date();
|
|
|
let fileName = getFileName(filePath);
|
|
|
- let fileKey = `export/report/${uniqueId}/${fileName}`;
|
|
|
+ fileKey = fileKey || `export/report/${uniqueId}/${fileName}`;
|
|
|
const r1 = await client?.put(fileKey, filePath);
|
|
|
console.log('put success: %j', r1);
|
|
|
return r1
|
|
@@ -128,6 +128,7 @@ module.exports.createZip = createZip
|
|
|
|
|
|
const download = require('download')
|
|
|
export async function downloadUrl(url,options) {
|
|
|
+ // console.log(url)
|
|
|
if(!fs.existsSync(options?.tempDir)) fs.mkdirSync(options?.tempDir);
|
|
|
// console.log(url)
|
|
|
if(url?.startsWith("/")) {return url};
|