From 66d96b2c4f8cbbe4364e2d9b17d50ececf739bee Mon Sep 17 00:00:00 2001 From: evoxwht <442384644@qq.com> Date: Thu, 13 Jul 2023 14:03:24 +0800 Subject: [PATCH] =?UTF-8?q?=E8=85=BE=E8=AE=AF=E4=BA=91=E4=BA=91=E5=AD=98?= =?UTF-8?q?=E5=82=A8=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/Cos.php | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/crmeb/crmeb/services/upload/storage/Cos.php b/crmeb/crmeb/services/upload/storage/Cos.php index 3e26b9601..1179b8b23 100644 --- a/crmeb/crmeb/services/upload/storage/Cos.php +++ b/crmeb/crmeb/services/upload/storage/Cos.php @@ -440,14 +440,11 @@ class Cos extends BaseUpload public function deleteBucket(string $name) { try { - $res = $this->app()->deleteBucket($name); - if ($res->get('RequestId')) { - return true; - } + $this->app()->deleteBucket($name); + return true; } catch (\Throwable $e) { return $this->setError($e->getMessage()); } - return false; } /** @@ -459,8 +456,8 @@ class Cos extends BaseUpload { $this->storageRegion = $region; try { - $res = $this->app()->GetBucketDomain($name); - $domainRules = $res->toArray()['DomainRules']; + $res = $this->app()->getBucketDomain($name); + $domainRules = $res['DomainRules']; return array_column($domainRules, 'Name'); } catch (\Throwable $e) { } @@ -533,11 +530,11 @@ class Cos extends BaseUpload { $this->storageRegion = $region; try { - $res = $this->app()->PutBucketCors($name, [ - 'AllowedHeaders' => ['*'], - 'AllowedMethods' => ['PUT', 'GET', 'POST', 'DELETE', 'HEAD'], - 'AllowedOrigins' => ['*'], - 'ExposeHeaders' => ['ETag', 'Content-Length', 'x-cos-request-id'], + $res = $this->app()->putBucketCors($name, [ + 'AllowedHeader' => ['*'], + 'AllowedMethod' => ['PUT', 'GET', 'POST', 'DELETE', 'HEAD'], + 'AllowedOrigin' => ['*'], + 'ExposeHeader' => ['ETag', 'Content-Length', 'x-cos-request-id'], 'MaxAgeSeconds' => 12 ]); if (isset($res['RequestId'])) {