数据同步更改
parent
6c88af0a03
commit
fea0047f58
|
|
@ -60,7 +60,11 @@ async function ossGenerateSTS() {
|
|||
let params = Object.assign({path: objectName}, fileInfo)
|
||||
addOrUpdateFileUploadRecord(params)
|
||||
} else if (trialId) {
|
||||
let params = { trialId, path: objectName }
|
||||
const fileName = objectName.split('/').pop()
|
||||
const fileType = fileName.includes('.')
|
||||
? fileName.split('.').pop().toLowerCase()
|
||||
: ''
|
||||
let params = { trialId, path: objectName, fileName, fileType }
|
||||
addOrUpdateFileUploadRecord(params)
|
||||
}
|
||||
resolve({
|
||||
|
|
@ -113,7 +117,11 @@ async function ossGenerateSTS() {
|
|||
let params = Object.assign({path: data.path}, fileInfo)
|
||||
addOrUpdateFileUploadRecord(params)
|
||||
} else if (trialId) {
|
||||
let params = { trialId, path: data.path }
|
||||
const fileName = data.path.split('/').pop()
|
||||
const fileType = fileName.includes('.')
|
||||
? fileName.split('.').pop().toLowerCase()
|
||||
: ''
|
||||
let params = { trialId, path: data.path, fileName, fileType }
|
||||
addOrUpdateFileUploadRecord(params)
|
||||
}
|
||||
|
||||
|
|
@ -241,7 +249,11 @@ function uploadAWS(aws, data, progress, fileInfo) {
|
|||
let params = Object.assign({path: decodeUtf8(curPath)}, fileInfo)
|
||||
addOrUpdateFileUploadRecord(params)
|
||||
} else if (trialId) {
|
||||
let params = { trialId, path: decodeUtf8(curPath) }
|
||||
const fileName = decodeUtf8(curPath).split('/').pop()
|
||||
const fileType = fileName.includes('.')
|
||||
? fileName.split('.').pop().toLowerCase()
|
||||
: ''
|
||||
let params = { trialId, path: decodeUtf8(curPath), fileName, fileType }
|
||||
addOrUpdateFileUploadRecord(params)
|
||||
}
|
||||
resolve({
|
||||
|
|
@ -356,33 +368,33 @@ function isCredentialsExpired(credentials) {
|
|||
function mimeTypeToExt(mimeType) {
|
||||
const map = {
|
||||
// 图片
|
||||
'image/jpeg': '.jpg',
|
||||
'image/jpg': '.jpg',
|
||||
'image/png': '.png',
|
||||
'image/gif': '.gif',
|
||||
'image/webp': '.webp',
|
||||
'image/svg+xml': '.svg',
|
||||
'image/bmp': '.bmp',
|
||||
'image/jpeg': 'jpg',
|
||||
'image/jpg': 'jpg',
|
||||
'image/png': 'png',
|
||||
'image/gif': 'gif',
|
||||
'image/webp': 'webp',
|
||||
'image/svg+xml': 'svg',
|
||||
'image/bmp': 'bmp',
|
||||
|
||||
// 文档
|
||||
'application/dicom': '.dcm',
|
||||
'application/pdf': '.pdf',
|
||||
'application/msword': '.doc',
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.document': '.docx',
|
||||
'application/vnd.ms-excel': '.xls',
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': '.xlsx',
|
||||
'application/dicom': 'dcm',
|
||||
'application/pdf': 'pdf',
|
||||
'application/msword': 'doc',
|
||||
'application/vnd.openxmlformats-officedocument.wordprocessingml.document': 'docx',
|
||||
'application/vnd.ms-excel': 'xls',
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': 'xlsx',
|
||||
'application/vnd.ms-powerpoint': '.ppt',
|
||||
'application/vnd.openxmlformats-officedocument.presentationml.presentation': '.pptx',
|
||||
'text/plain': '.txt',
|
||||
'application/vnd.openxmlformats-officedocument.presentationml.presentation': 'pptx',
|
||||
'text/plain': 'txt',
|
||||
// 音频/视频
|
||||
'audio/mpeg': '.mp3',
|
||||
'audio/wav': '.wav',
|
||||
'video/mp4': '.mp4',
|
||||
'video/mpeg': '.mpeg',
|
||||
'audio/mpeg': 'mp3',
|
||||
'audio/wav': 'wav',
|
||||
'video/mp4': 'mp4',
|
||||
'video/mpeg': 'mpeg',
|
||||
// 压缩包
|
||||
'application/zip': '.zip',
|
||||
'application/x-rar-compressed': '.rar',
|
||||
'application/x-7z-compressed': '.7z',
|
||||
'application/zip': 'zip',
|
||||
'application/x-rar-compressed': 'rar',
|
||||
'application/x-7z-compressed': '7z',
|
||||
};
|
||||
return map[mimeType] || ''; // 找不到返回空字符串
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue