import { request } from '../../utils/requset2'; // 获取文件列表 export function getFiles(data) { return request({ url: '/minio/file', method: 'get', data, params: data }); } // 获取ai文件列表 export function getAiFiles(data) { return request({ url: '/minio/ai/file', method: 'get', data, params: data }); } // 获取文件信息 export function getInfo(data) { return request({ url: '/minio/info', method: 'get', data, params: data, timeout: 30000 }); } // 获取ai文件信息 export function getAiInfo(data) { return request({ url: '/minio/ai/info', method: 'get', data, params: data, timeout: 30000 }); } // 下载文件 export function fileDownload(params, onProgress) { return request({ url: '/minio/download', method: 'post', params, responseType: 'blob', timeout: 0, // header: { // "Content-Length": Buffer.byteLength(JSON.stringify(params)), // }, onDownloadProgress: (progressEvent) => { if (onProgress && typeof onProgress === 'function') { const { loaded, total } = progressEvent; console.log('progressEvent', progressEvent); const percentage = Math.round((loaded / total) * 100); // 计算百分比 onProgress(percentage); // 调用传入的 onProgress 回调函数 } } }); } // 删除文件 export function deleteFile(data) { return request({ url: '/minio/deleteBatch', method: 'delete', data, timeout: 0 }); } // 删除ai文件 export function deleteAiFile(data) { return request({ url: '/minio/ai/deleteBatch', method: 'delete', data, timeout: 0 }); } // 批量下载文件或目录 export function downloadBatch(data, onProgress) { return request({ url: '/minio/downloadBatch', method: 'post', responseType: 'blob', data, timeout: 0, onDownloadProgress: (progressEvent) => { if (onProgress && typeof onProgress === 'function') { const { loaded, total } = progressEvent; console.log('progressEvent', progressEvent); const percentage = Math.round((loaded / total) * 100); // 计算百分比 onProgress(percentage); // 调用传入的 onProgress 回调函数 } } }); } // 获取某个目录下面的所有文件的URL列表 export function getUrlList(data) { return request({ url: '/minio/urlList', method: 'post', data, params: data, timeout: 0 }); } // 获取某个目录下面的所有文件的URL列表 export function getAiUrlList(data) { return request({ url: '/minio/ai/urlList', method: 'post', data, params: data, timeout: 0 }); }