From 4c550c8b1a67353ee6e5d2c013b63a380ecb2ccf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E8=83=A1?= <140248955+xiaohu2002@users.noreply.github.com> Date: Fri, 8 Nov 2024 20:03:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B7=BB=E5=8A=A0=E8=85=BE?= =?UTF-8?q?=E8=AE=AF=E4=BA=91=E5=AD=98=E5=82=A8=E6=97=B6=E6=97=A0=E6=B3=95?= =?UTF-8?q?=E8=8E=B7=E5=8F=96bucket=E5=88=97=E8=A1=A8=E9=97=AE=E9=A2=98=20?= =?UTF-8?q?(#272)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 修复添加腾讯云存储时无法获取bucket列表问题 * 修改提示UI --- admin/cloud/template/oauth_qcos.htm | 4 ++-- core/class/io/io_QCOS.php | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/admin/cloud/template/oauth_qcos.htm b/admin/cloud/template/oauth_qcos.htm index 30f7a3e..041515b 100644 --- a/admin/cloud/template/oauth_qcos.htm +++ b/admin/cloud/template/oauth_qcos.htm @@ -112,7 +112,7 @@ } jQuery.getJSON('{BASESCRIPT}?mod=cloud&op=oauth&do=getBucket', { id: id, key: key,region:region,bz:bz }, function(json) { if(json.error){ - showmessage(json.error); + showmessage(json.error,'error',3000,1); }else{ if(json.length > 0) { var html = ''; @@ -148,4 +148,4 @@ } - \ No newline at end of file + diff --git a/core/class/io/io_QCOS.php b/core/class/io/io_QCOS.php index e32bb37..0f1b9fb 100644 --- a/core/class/io/io_QCOS.php +++ b/core/class/io/io_QCOS.php @@ -207,8 +207,12 @@ class io_Qcos extends io_api try { //请求成功 if ($list = $qcos->listBuckets()) { - foreach ($list['Buckets'][0] as $value) { - $re[] = $value['Name']; + if (isset($list['Buckets']) && !empty($list['Buckets'][0]['Bucket'])) { + foreach ($list['Buckets'][0]['Bucket'] as $value) { + $re[] = $value['Name']; + } + } else { + return array('error' => 'Bucket为空!'); } } else { return array();