调整云存储问题

This commit is contained in:
liaofei 2023-05-17 16:58:14 +08:00
parent d94b98ef54
commit b5df1c993a
3 changed files with 13 additions and 1 deletions

View File

@ -74,6 +74,8 @@ class SystemStorageDao extends BaseDao
$query->where('type', $where['type']);
})->where('is_delete', 0)->when(isset($where['access_key']), function ($query) use ($where) {
$query->where('access_key', $where['access_key']);
})->when(!empty($where['id']), function ($query) use ($where) {
$query->where('id', $where['id']);
});
}
}

View File

@ -315,6 +315,11 @@ class SystemStorageServices extends BaseServices
case 4:// 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']])) {
@ -438,6 +443,9 @@ class SystemStorageServices extends BaseServices
//是否添加过域名不存在需要绑定域名
$domainList = $upload->getDomian($info->name, $info->region);
$domainParse = parse_url($domain);
if (false === $domainParse) {
throw new AdminException('域名输入有误');
}
if (!in_array($domainParse['host'], $domainList)) {
//绑定域名到云储存桶
$res = $upload->bindDomian($info->name, $domain, $info->region);

View File

@ -478,7 +478,9 @@ class Cos extends BaseUpload
'Type' => 'REST',
'ForcedReplacement' => 'CNAME'
]);
$res = $res->toArray();
if (method_exists($res, 'toArray')) {
$res = $res->toArray();
}
if ($res['RequestId'] ?? null) {
return true;
}