mergefromextraFile

This commit is contained in:
wenjiarui 2023-09-20 19:28:19 +08:00
parent 5e54470fd9
commit 7228ea7983
2 changed files with 20 additions and 18 deletions

View File

@ -17,23 +17,24 @@ export default class Qiniu {
}
async upload(extraFile, uploadFn, file) {
const uploadMeta = extraFile.uploadMeta;
let result;
try {
const result = await uploadFn(file, 'file', uploadMeta.uploadHost, {
result = await uploadFn(file, 'file', uploadMeta.uploadHost, {
key: uploadMeta.key,
token: uploadMeta.uploadToken,
}, true);
console.log(result);
// await new Promise(
// () => setTimeout(() => { return Promise.resolve() }, 10000)
// )
if (result.success === true || result.key) {
return;
}
}
catch (err) {
// 网络错误
throw new OakUploadException('图片上传失败');
}
// 解析回调
if (result.success === true || result.key) {
return;
}
else {
throw new OakUploadException('图片上传失败');
}
throw new OakUploadException('图片上传失败');
}
composeFileUrl(extraFile, config, style) {
const { objectId, extension, entity, } = extraFile || {};

View File

@ -19,23 +19,24 @@ class Qiniu {
}
async upload(extraFile, uploadFn, file) {
const uploadMeta = extraFile.uploadMeta;
let result;
try {
const result = await uploadFn(file, 'file', uploadMeta.uploadHost, {
result = await uploadFn(file, 'file', uploadMeta.uploadHost, {
key: uploadMeta.key,
token: uploadMeta.uploadToken,
}, true);
console.log(result);
// await new Promise(
// () => setTimeout(() => { return Promise.resolve() }, 10000)
// )
if (result.success === true || result.key) {
return;
}
}
catch (err) {
// 网络错误
throw new Exception_1.OakUploadException('图片上传失败');
}
// 解析回调
if (result.success === true || result.key) {
return;
}
else {
throw new Exception_1.OakUploadException('图片上传失败');
}
throw new Exception_1.OakUploadException('图片上传失败');
}
composeFileUrl(extraFile, config, style) {
const { objectId, extension, entity, } = extraFile || {};