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] =?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 []; }