Parcourir la source

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

evoxwht il y a 2 ans
Parent
commit
f03311b53a

+ 34 - 4
crmeb/app/services/system/config/SystemStorageServices.php

@@ -189,7 +189,10 @@ class SystemStorageServices extends BaseServices
 
 
         try {
         try {
             $upload = UploadService::init($storageInfo->type);
             $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) {
         } catch (\Throwable $e) {
             throw new AdminException($e->getMessage());
             throw new AdminException($e->getMessage());
         }
         }
@@ -369,10 +372,37 @@ class SystemStorageServices extends BaseServices
                 }
                 }
                 break;
                 break;
             case 5:// cos 京东云
             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 6:// cos 华为云
             case 7:// cos 天翼云
             case 7:// cos 天翼云
                 $upload = UploadService::init($type);
                 $upload = UploadService::init($type);
                 $list = $upload->listbuckets();
                 $list = $upload->listbuckets();
+                if (!empty($list['Name'])) {
+                    $newList = $list;
+                    $list = [];
+                    $list[] = $newList;
+                }
                 $config = $this->getStorageConfig($type);
                 $config = $this->getStorageConfig($type);
                 foreach ($list as $item) {
                 foreach ($list as $item) {
                     if (!$this->dao->count(['name' => $item['Name'], 'access_key' => $config['accessKey']])) {
                     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';
                 $domainName = 'https://' . $name . ($appid ? '-' . $appid : '') . '.cos.' . $reagion . '.myqcloud.com';
                 break;
                 break;
             case 5:// cos 京东云
             case 5:// cos 京东云
-                $domainName = 'https://' . $name . '.cos.' . $reagion . '.jdcloud-oss.com';
+                $domainName = 'https://' . $name . '.s3.' . $reagion . '.jdcloud-oss.com';
                 break;
                 break;
             case 6:// cos 华为云
             case 6:// cos 华为云
-                $domainName = 'https://' . $name . '.cos.' . $reagion . '.myhuaweicloud.com';
+                $domainName = 'https://' . $name . '.obs.' . $reagion . '.myhuaweicloud.com';
                 break;
                 break;
             case 7:// cos 天翼云
             case 7:// cos 天翼云
-                $domainName = 'https://' . $name . '.cos.' . $reagion . '.ctyun.cn';
+                $domainName = 'https://' . $name . '.obs.' . $reagion . '.ctyun.cn';
                 break;
                 break;
         }
         }
         return $domainName;
         return $domainName;

+ 1 - 1
crmeb/crmeb/services/upload/extend/obs/Client.php

@@ -422,7 +422,7 @@ class Client extends BaseClient
         if ($this->type == 'hw') {
         if ($this->type == 'hw') {
             $url = '.myhuaweicloud.com';  // 华为
             $url = '.myhuaweicloud.com';  // 华为
         } else {
         } else {
-            $url = $region . '.ctyun.cn';  // 天翼
+            $url = '.ctyun.cn';  // 天翼
         }
         }
         if ($bucket) {
         if ($bucket) {
             return $bucket . '.obs.' . $region . $url;
             return $bucket . '.obs.' . $region . $url;

+ 2 - 3
crmeb/crmeb/services/upload/storage/Jdoss.php

@@ -207,7 +207,7 @@ class Jdoss extends BaseUpload
     {
     {
         try {
         try {
             $res = $this->app()->listBuckets();
             $res = $this->app()->listBuckets();
-            return $res['ListAllMyBucketsResult']['Buckets'] ?? [];
+            return $res ?? [];
         } catch (\Throwable $e) {
         } catch (\Throwable $e) {
             return [];
             return [];
         }
         }
@@ -277,8 +277,7 @@ class Jdoss extends BaseUpload
         try {
         try {
             $this->storageRegion = $region;
             $this->storageRegion = $region;
             $this->app()->deleteBucket([
             $this->app()->deleteBucket([
-                'bucketName' => $name, // REQUIRED
-                'forceDelete' => false
+                'Bucket' => $name, // REQUIRED
             ]);
             ]);
             return true;
             return true;
         } catch (AcmException $e) {
         } catch (AcmException $e) {

+ 4 - 5
crmeb/crmeb/services/upload/storage/Tyoss.php

@@ -361,10 +361,10 @@ class Tyoss extends BaseUpload
     {
     {
         try {
         try {
             $this->app()->PutBucketCors($name, $region, [
             $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
                 'MaxAgeSeconds' => 100
             ]);
             ]);
             return true;
             return true;
@@ -372,7 +372,6 @@ class Tyoss extends BaseUpload
             return $this->setError($e->getMessage());
             return $this->setError($e->getMessage());
         }
         }
     }
     }
-
     public function getTempKeys()
     public function getTempKeys()
     {
     {
         // TODO: Implement getTempKeys() method.
         // TODO: Implement getTempKeys() method.

+ 17 - 2
template/admin/src/pages/setting/storage/index.vue

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