From 96e872306c8db8e49dbfc0bce4ed9d8ebcfe7657 Mon Sep 17 00:00:00 2001 From: Gosowong <1329847115@qq.com> Date: Thu, 8 Jun 2023 18:32:35 +0800 Subject: [PATCH 1/5] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E5=A4=A9=E7=BF=BC?= =?UTF-8?q?=E4=BA=91=E4=BA=91=E5=82=A8=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/services/system/config/SystemStorageServices.php | 6 +++--- crmeb/crmeb/services/upload/extend/obs/Client.php | 2 +- crmeb/crmeb/services/upload/storage/Tyoss.php | 9 ++++----- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/crmeb/app/services/system/config/SystemStorageServices.php b/crmeb/app/services/system/config/SystemStorageServices.php index 85d0c3f7e..381b2d2b2 100644 --- a/crmeb/app/services/system/config/SystemStorageServices.php +++ b/crmeb/app/services/system/config/SystemStorageServices.php @@ -437,13 +437,13 @@ class SystemStorageServices extends BaseServices $domainName = 'https://' . $name . ($appid ? '-' . $appid : '') . '.cos.' . $reagion . '.myqcloud.com'; break; case 5:// cos 京东云 - $domainName = 'https://' . $name . '.cos.' . $reagion . '.jdcloud-oss.com'; + $domainName = 'https://' . $name . '.s3.' . $reagion . '.jdcloud-oss.com'; break; case 6:// cos 华为云 - $domainName = 'https://' . $name . '.cos.' . $reagion . '.myhuaweicloud.com'; + $domainName = 'https://' . $name . '.obs.' . $reagion . '.myhuaweicloud.com'; break; case 7:// cos 天翼云 - $domainName = 'https://' . $name . '.cos.' . $reagion . '.ctyun.cn'; + $domainName = 'https://' . $name . '.obs.' . $reagion . '.ctyun.cn'; break; } return $domainName; diff --git a/crmeb/crmeb/services/upload/extend/obs/Client.php b/crmeb/crmeb/services/upload/extend/obs/Client.php index 222b04b8f..b2ad87782 100644 --- a/crmeb/crmeb/services/upload/extend/obs/Client.php +++ b/crmeb/crmeb/services/upload/extend/obs/Client.php @@ -422,7 +422,7 @@ class Client extends BaseClient if ($this->type == 'hw') { $url = '.myhuaweicloud.com'; // 华为 } else { - $url = $region . '.ctyun.cn'; // 天翼 + $url = '.ctyun.cn'; // 天翼 } if ($bucket) { return $bucket . '.obs.' . $region . $url; diff --git a/crmeb/crmeb/services/upload/storage/Tyoss.php b/crmeb/crmeb/services/upload/storage/Tyoss.php index 61e9b862c..1e90dad7c 100644 --- a/crmeb/crmeb/services/upload/storage/Tyoss.php +++ b/crmeb/crmeb/services/upload/storage/Tyoss.php @@ -361,10 +361,10 @@ class Tyoss extends BaseUpload { try { $this->app()->PutBucketCors($name, $region, [ - 'AllowedHeaders' => ['*'], - 'AllowedMethods' => ['PUT', 'GET', 'POST', 'DELETE', 'HEAD'], - 'AllowedOrigins' => ['*'], - 'ExposeHeaders' => ['ETag', 'Content-Length', 'x-cos-request-id'], + 'AllowedHeader' => ['*'], + 'AllowedMethod' => ['PUT', 'GET', 'POST', 'DELETE', 'HEAD'], + 'AllowedOrigin' => ['*'], + 'ExposeHeader' => ['ETag', 'Content-Length', 'x-cos-request-id'], 'MaxAgeSeconds' => 100 ]); return true; @@ -372,7 +372,6 @@ class Tyoss extends BaseUpload return $this->setError($e->getMessage()); } } - public function getTempKeys() { // TODO: Implement getTempKeys() method. From 123a918ce7689b5f1dfbfd1b423d85556d628ed7 Mon Sep 17 00:00:00 2001 From: Gosowong <1329847115@qq.com> Date: Thu, 8 Jun 2023 18:49:43 +0800 Subject: [PATCH 2/5] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=A1=B6=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crmeb/app/services/system/config/SystemStorageServices.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crmeb/app/services/system/config/SystemStorageServices.php b/crmeb/app/services/system/config/SystemStorageServices.php index 381b2d2b2..bce4921c8 100644 --- a/crmeb/app/services/system/config/SystemStorageServices.php +++ b/crmeb/app/services/system/config/SystemStorageServices.php @@ -189,7 +189,10 @@ class SystemStorageServices extends BaseServices try { $upload = UploadService::init($storageInfo->type); - $upload->deleteBucket($storageInfo->name, $storageInfo->region); + $res = $upload->deleteBucket($storageInfo->name, $storageInfo->region); + if (false === $res) { + throw new AdminException($upload->getError()); + } } catch (\Throwable $e) { throw new AdminException($e->getMessage()); } From 02dd5044fcbf99538a12ecda494bf3bc2bcae0b2 Mon Sep 17 00:00:00 2001 From: Gosowong <1329847115@qq.com> Date: Thu, 8 Jun 2023 19:11:51 +0800 Subject: [PATCH 3/5] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E4=BA=AC=E4=B8=9C?= =?UTF-8?q?=E4=BA=91=E5=90=8C=E6=AD=A5=E5=82=A8=E5=AD=98=E7=A9=BA=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/config/SystemStorageServices.php | 27 +++++++++++++++++++ crmeb/crmeb/services/upload/storage/Jdoss.php | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/crmeb/app/services/system/config/SystemStorageServices.php b/crmeb/app/services/system/config/SystemStorageServices.php index bce4921c8..d59cf6084 100644 --- a/crmeb/app/services/system/config/SystemStorageServices.php +++ b/crmeb/app/services/system/config/SystemStorageServices.php @@ -372,10 +372,37 @@ class SystemStorageServices extends BaseServices } break; case 5:// cos 京东云 + $upload = UploadService::init($type); + $res = $upload->listbuckets(); + $list = $res['Buckets']; + $location = explode('.', $res['@metadata']['effectiveUri'])[1] ?? 'cn-north-1'; + $config = $this->getStorageConfig($type); + foreach ($list as $item) { + if (!$this->dao->count(['name' => $item['Name'], 'access_key' => $config['accessKey']])) { + $data[] = [ + 'type' => $type, + 'access_key' => $config['accessKey'], + 'name' => $item['Name'], + 'region' => $location, + 'acl' => 'public-read', + 'status' => 0, + 'domain' => $this->getDomain($type, $item['Name'], $location), + 'is_delete' => 0, + 'add_time' => time(), + 'update_time' => time() + ]; + } + } + break; case 6:// cos 华为云 case 7:// cos 天翼云 $upload = UploadService::init($type); $list = $upload->listbuckets(); + if (!empty($list['Name'])) { + $newList = $list; + $list = []; + $list[] = $newList; + } $config = $this->getStorageConfig($type); foreach ($list as $item) { if (!$this->dao->count(['name' => $item['Name'], 'access_key' => $config['accessKey']])) { diff --git a/crmeb/crmeb/services/upload/storage/Jdoss.php b/crmeb/crmeb/services/upload/storage/Jdoss.php index 867a63275..5959bfbe2 100644 --- a/crmeb/crmeb/services/upload/storage/Jdoss.php +++ b/crmeb/crmeb/services/upload/storage/Jdoss.php @@ -207,7 +207,7 @@ class Jdoss extends BaseUpload { try { $res = $this->app()->listBuckets(); - return $res['ListAllMyBucketsResult']['Buckets'] ?? []; + return $res ?? []; } catch (\Throwable $e) { return []; } From 00c6b32119cf8ccc2f82da9fec883b8b5f7134df Mon Sep 17 00:00:00 2001 From: Gosowong <1329847115@qq.com> Date: Thu, 8 Jun 2023 19:22:10 +0800 Subject: [PATCH 4/5] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E4=BA=AC=E4=B8=9C?= =?UTF-8?q?=E4=BA=91=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crmeb/crmeb/services/upload/storage/Jdoss.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/crmeb/crmeb/services/upload/storage/Jdoss.php b/crmeb/crmeb/services/upload/storage/Jdoss.php index 5959bfbe2..b8c5d1f72 100644 --- a/crmeb/crmeb/services/upload/storage/Jdoss.php +++ b/crmeb/crmeb/services/upload/storage/Jdoss.php @@ -277,8 +277,7 @@ class Jdoss extends BaseUpload try { $this->storageRegion = $region; $this->app()->deleteBucket([ - 'bucketName' => $name, // REQUIRED - 'forceDelete' => false + 'Bucket' => $name, // REQUIRED ]); return true; } catch (AcmException $e) { From 4908b685332c26d0ca42954943954410d2b9c2ac Mon Sep 17 00:00:00 2001 From: Gosowong <1329847115@qq.com> Date: Fri, 9 Jun 2023 09:14:45 +0800 Subject: [PATCH 5/5] =?UTF-8?q?fix:=20=E5=89=8D=E7=AB=AF=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=91=E5=AD=98=E5=82=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/src/pages/setting/storage/index.vue | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/template/admin/src/pages/setting/storage/index.vue b/template/admin/src/pages/setting/storage/index.vue index 3b0f0f41f..fab0b5b78 100644 --- a/template/admin/src/pages/setting/storage/index.vue +++ b/template/admin/src/pages/setting/storage/index.vue @@ -29,6 +29,15 @@
腾讯云cos开通方法:点击查看
++ 京东云cos开通方法:点击查看 +
++ 华为云cos开通方法:点击查看 +
++ 天翼云cos开通方法:点击查看 +
第一步: 添加【存储空间】(空间名称不能重复)
第二步: 开启【使用状态】
@@ -52,6 +61,9 @@