数据同步更改

uat_us
caiyiling 2026-04-24 16:10:35 +08:00
parent 6c88af0a03
commit fea0047f58
1 changed files with 37 additions and 25 deletions

View File

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