Merge branch 'v5.1.0dev' of https://gitee.com/ZhongBangKeJi/CRMEB into v5.1.0dev

This commit is contained in:
evoxwht 2023-06-09 10:26:16 +08:00
commit f03311b53a
5 changed files with 58 additions and 15 deletions

View File

@ -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());
}
@ -369,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']])) {
@ -437,13 +467,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;

View File

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

View File

@ -207,7 +207,7 @@ class Jdoss extends BaseUpload
{
try {
$res = $this->app()->listBuckets();
return $res['ListAllMyBucketsResult']['Buckets'] ?? [];
return $res ?? [];
} catch (\Throwable $e) {
return [];
}
@ -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) {

View File

@ -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.

View File

@ -29,6 +29,15 @@
<p v-if="currentTab == 4">
腾讯云cos开通方法:<a href="https://doc.crmeb.com/web/single/crmeb_v4/986" target="_blank">点击查看</a>
</p>
<p v-if="currentTab == 5">
京东云cos开通方法:<a href="https://doc.crmeb.com/web/single/crmeb_v4/986" target="_blank">点击查看</a>
</p>
<p v-if="currentTab == 6">
华为云cos开通方法:<a href="https://doc.crmeb.com/web/single/crmeb_v4/986" target="_blank">点击查看</a>
</p>
<p v-if="currentTab == 7">
天翼云cos开通方法:<a href="https://doc.crmeb.com/web/single/crmeb_v4/986" target="_blank">点击查看</a>
</p>
<p>第一步: 添加【存储空间】(空间名称不能重复)</p>
<p>第二步: 开启【使用状态】</p>
<template v-if="currentTab == 2">
@ -52,6 +61,9 @@
<Radio label="2">七牛云存储</Radio>
<Radio label="3">阿里云存储</Radio>
<Radio label="4">腾讯云存储</Radio>
<Radio label="5">京东云存储</Radio>
<Radio label="6">华为云存储</Radio>
<Radio label="7">天翼云存储</Radio>
</RadioGroup>
<!-- <i-switch
v-model="localStorage"
@ -322,7 +334,7 @@
</Card>
</div>
<!-- 缩略图配置 -->
<div class="pt10" v-else-if="currentTab == 5"></div>
<div class="pt10" v-else-if="currentTab == 10">我去恶趣味我去</div>
<div class="pt10" v-else>
<Card :bordered="false" dis-hover class="ivu-mt">
<Row type="flex" class="mb20">
@ -482,7 +494,10 @@ export default {
{ label: '七牛云储存', value: '2' },
{ label: '阿里云储存', value: '3' },
{ label: '腾讯云储存', value: '4' },
// { label: "缩略图配置", value: "5" },
{ label: '京东云储存', value: '5' },
{ label: '华为云储存', value: '6' },
{ label: '天翼云储存', value: '7' },
// { label: "缩略图配置", value: "10" },
],
columns: [
{