From ea3f786905d2e7739badde0c4e576835db354847 Mon Sep 17 00:00:00 2001 From: evoxwht <442384644@qq.com> Date: Mon, 19 Jun 2023 11:55:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=AC=E4=B8=9C=E4=BA=91=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E9=97=AE=E9=A2=98=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crmeb/crmeb/services/upload/storage/Jdoss.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/crmeb/crmeb/services/upload/storage/Jdoss.php b/crmeb/crmeb/services/upload/storage/Jdoss.php index 4435ded6d..34945bfed 100644 --- a/crmeb/crmeb/services/upload/storage/Jdoss.php +++ b/crmeb/crmeb/services/upload/storage/Jdoss.php @@ -114,6 +114,7 @@ class Jdoss extends BaseUpload 'region' => $this->storageRegion, 'endpoint' => "http://s3.{$this->storageRegion}.jdcloud-oss.com", 'signature_version' => 'v4', + 'use_path_style_endpoint' => true, 'credentials' => [ 'key' => $this->accessKey, 'secret' => $this->secretKey, @@ -326,11 +327,11 @@ class Jdoss extends BaseUpload 'CORSConfiguration' => [ // REQUIRED 'CORSRules' => [ // REQUIRED [ - 'AllowedHeaders' => ['Authorization'], - 'AllowedMethods' => ['POST', 'GET', 'PUT'], // REQUIRED + 'AllowedHeaders' => ['*'], + 'AllowedMethods' => ['POST', 'GET', 'PUT', 'DELETE', 'HEAD'], // REQUIRED 'AllowedOrigins' => ['*'], // REQUIRED - 'ExposeHeaders' => [], - 'MaxAgeSeconds' => 3000 + 'ExposeHeaders' => ['Etag'], + 'MaxAgeSeconds' => 0 ], ], ] @@ -353,14 +354,15 @@ class Jdoss extends BaseUpload 'PutObject', [ 'Bucket' => $this->storageName, 'Key' => $key, - 'SourceFile' => $path, +// 'SourceFile' => $path, 'ContentType' => $contentType ] ); - $request = $app->createPresignedRequest($cmd, $expires); + $request = $app->createPresignedRequest($cmd, $expires, ['Scheme' => 'https']); return [ - 'url' => (string)$request->getUri(), - 'type' => 'JDOSS' + 'upload_url' => (string)$request->getUri(), + 'type' => 'JDOSS', + 'url' => $this->uploadUrl . '/' . $key ]; } catch (\Throwable $e) { return $this->setError($e->getMessage());