修复添加腾讯云存储时无法获取bucket列表问题 (#272)

* 修复添加腾讯云存储时无法获取bucket列表问题

* 修改提示UI
This commit is contained in:
小胡 2024-11-08 20:03:12 +08:00 committed by GitHub
parent 3a454bbcce
commit 4c550c8b1a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 8 additions and 4 deletions

View File

@ -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 @@
}
</script>
<script src="static/bootstrap/js/bootstrap.min.js?{VERHASH}"></script>
<!--{template common/footer_simple}-->
<!--{template common/footer_simple}-->

View File

@ -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();