This commit is contained in:
张成
2025-11-28 15:15:22 +08:00
parent ab8179713c
commit 37acdd48b0
2 changed files with 6 additions and 2 deletions

View File

@@ -10,12 +10,15 @@ const logs = require('../middleware/logProxy')
*/ */
class OSSToolService { class OSSToolService {
constructor() { constructor() {
const { accessKeyId, accessKeySecret, bucket, region } = config.oos; const { accessKeyId, accessKeySecret, bucket, region, timeout } = config.oos;
// 设置超时时间默认30分钟1800000ms适用于大文件上传
// 可以从配置文件读取,如果没有配置则使用默认值
this.client = new OSS({ this.client = new OSS({
region, region,
accessKeyId, accessKeyId,
accessKeySecret, accessKeySecret,
bucket, bucket,
timeout: timeout || 30 * 60 * 1000, // 30分钟超时1800000ms
}) })

View File

@@ -38,7 +38,8 @@ module.exports = {
"accessKeyId": "LTAI5tENEdLxFU7Ne9wGazsk", "accessKeyId": "LTAI5tENEdLxFU7Ne9wGazsk",
"accessKeySecret": "nvfvDfz2tLcOH8XE3EQpXsnBFpVyK5", "accessKeySecret": "nvfvDfz2tLcOH8XE3EQpXsnBFpVyK5",
region: 'oss-cn-beijing', region: 'oss-cn-beijing',
bucket: 'light22600' bucket: 'light22600',
timeout: 30 * 60 * 1000 // OSS 请求超时时间30分钟适用于大文件上传
}, },
// 分页配置 // 分页配置