Explorar el Código

腾讯云云存储问题修复

evoxwht hace 2 años
padre
commit
66d96b2c4f
Se han modificado 1 ficheros con 9 adiciones y 12 borrados
  1. 9 12
      crmeb/crmeb/services/upload/storage/Cos.php

+ 9 - 12
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'])) {