Просмотр исходного кода

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

From-wh 2 лет назад
Родитель
Сommit
bd060d2b27

+ 1 - 1
crmeb/app/adminapi/controller/v1/order/StoreOrder.php

@@ -465,7 +465,7 @@ class StoreOrder extends AuthController
      */
      */
     public function order_info($id)
     public function order_info($id)
     {
     {
-        if (!$id || !($orderInfo = $this->services->get($id, [], ['refund']))) {
+        if (!$id || !($orderInfo = $this->services->get($id, [], ['refund','invoice']))) {
             return app('json')->fail(400118);
             return app('json')->fail(400118);
         }
         }
         /** @var UserServices $services */
         /** @var UserServices $services */

+ 6 - 6
crmeb/app/services/activity/combination/StorePinkServices.php

@@ -97,7 +97,7 @@ class StorePinkServices extends BaseServices
      */
      */
     public function getPinkMember(int $id)
     public function getPinkMember(int $id)
     {
     {
-        return $this->dao->getList(['k_id' => $id, 'is_refund' => 0]);
+        return $this->dao->getList(['k_id' => $id]);
     }
     }
 
 
     /**
     /**
@@ -130,15 +130,15 @@ class StorePinkServices extends BaseServices
                 $res11 = $this->dao->update($id, ['k_id' => $kCount['id']], 'k_id');
                 $res11 = $this->dao->update($id, ['k_id' => $kCount['id']], 'k_id');
                 $res12 = $this->dao->update($kCount['id'], ['stop_time' => $count['add_time'] + 86400, 'k_id' => 0]);
                 $res12 = $this->dao->update($kCount['id'], ['stop_time' => $count['add_time'] + 86400, 'k_id' => 0]);
                 $res1 = $res11 && $res12;
                 $res1 = $res11 && $res12;
-                $res2 = $this->dao->update($id, ['stop_time' => time() - 1, 'k_id' => 0, 'is_refund' => $kCount['id'], 'status' => 3]);
+                $res2 = $this->dao->update($id, ['stop_time' => time() - 1, 'k_id' => $kCount['id'], 'is_refund' => $kCount['id'], 'status' => 3]);
             } else {
             } else {
                 $res1 = true;
                 $res1 = true;
-                $res2 = $this->dao->update($id, ['stop_time' => time() - 1, 'k_id' => 0, 'is_refund' => $id, 'status' => 3]);
+                $res2 = $this->dao->update($id, ['stop_time' => time() - 1, 'is_refund' => $id, 'status' => 3]);
             }
             }
             //修改结束时间为前一秒  团长ID为0
             //修改结束时间为前一秒  团长ID为0
             $res = $res1 && $res2;
             $res = $res1 && $res2;
         } else if ($countY) {//团员
         } else if ($countY) {//团员
-            $res = $this->dao->update($countY['id'], ['stop_time' => time() - 1, 'k_id' => 0, 'is_refund' => $id, 'status' => 3]);
+            $res = $this->dao->update($countY['id'], ['stop_time' => time() - 1, 'is_refund' => $id, 'status' => 3]);
         }
         }
         return $res;
         return $res;
     }
     }
@@ -221,10 +221,10 @@ class StorePinkServices extends BaseServices
     {
     {
         //查找拼团团员和团长
         //查找拼团团员和团长
         if ($pink['k_id']) {
         if ($pink['k_id']) {
-            $pinkAll = $this->dao->getPinkUserList(['k_id' => $pink['k_id'], 'is_refund' => 0]);
+            $pinkAll = $this->dao->getPinkUserList(['k_id' => $pink['k_id']]);
             $pinkT = $this->dao->getPinkUserOne($pink['k_id']);
             $pinkT = $this->dao->getPinkUserOne($pink['k_id']);
         } else {
         } else {
-            $pinkAll = $this->dao->getPinkUserList(['k_id' => $pink['id'], 'is_refund' => 0]);
+            $pinkAll = $this->dao->getPinkUserList(['k_id' => $pink['id']]);
             $pinkT = $pink;
             $pinkT = $pink;
         }
         }
         $count = count($pinkAll) + 1;
         $count = count($pinkAll) + 1;

+ 1 - 1
crmeb/app/services/other/UploadService.php

@@ -134,7 +134,7 @@ class UploadService
         /** @var SystemStorageServices $storageServices */
         /** @var SystemStorageServices $storageServices */
         $storageServices = app()->make(SystemStorageServices::class);
         $storageServices = app()->make(SystemStorageServices::class);
         $storageArr = $storageServices->cacheDriver()->remember('storage_list', function () use ($storageServices) {
         $storageArr = $storageServices->cacheDriver()->remember('storage_list', function () use ($storageServices) {
-            return $storageServices->selectList([], 'domain')->toArray();
+            return $storageServices->selectList([], 'domain,type')->toArray();
         });
         });
         foreach ($storageArr as $item) {
         foreach ($storageArr as $item) {
             if ($fileHost == $item['domain']) {
             if ($fileHost == $item['domain']) {

+ 1 - 0
crmeb/crmeb/services/upload/Upload.php

@@ -21,6 +21,7 @@ use think\facade\Config;
  * @mixin \crmeb\services\upload\storage\COS
  * @mixin \crmeb\services\upload\storage\COS
  * @mixin \crmeb\services\upload\storage\Qiniu
  * @mixin \crmeb\services\upload\storage\Qiniu
  * @mixin \crmeb\services\upload\storage\Jdoss
  * @mixin \crmeb\services\upload\storage\Jdoss
+ * @mixin \crmeb\services\upload\storage\Tyoss
  */
  */
 class Upload extends BaseManager
 class Upload extends BaseManager
 {
 {

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

@@ -124,6 +124,8 @@ class Client extends BaseClient
      */
      */
     protected $baseUrl = 'obs.cn-north-1.myhuaweicloud.com';
     protected $baseUrl = 'obs.cn-north-1.myhuaweicloud.com';
 
 
+    protected $type = 'hw';
+
     /**
     /**
      * Client constructor.
      * Client constructor.
      * @param array $config
      * @param array $config
@@ -135,6 +137,7 @@ class Client extends BaseClient
         $this->bucketName = $config['bucket'] ?? '';
         $this->bucketName = $config['bucket'] ?? '';
         $this->region = $config['region'] ?? 'ap-chengdu';
         $this->region = $config['region'] ?? 'ap-chengdu';
         $this->uploadUrl = $config['uploadUrl'] ?? '';
         $this->uploadUrl = $config['uploadUrl'] ?? '';
+        $this->type = $config['type'] ?? 'hw';
     }
     }
 
 
     /**
     /**
@@ -368,7 +371,13 @@ class Client extends BaseClient
      */
      */
     protected function getRequestUrl(string $bucket, string $region)
     protected function getRequestUrl(string $bucket, string $region)
     {
     {
-        return $bucket . '.obs.' . $region . '.myhuaweicloud.com';
+        if ($this->type == 'hw') {
+            return $bucket . '.obs.' . $region . '.myhuaweicloud.com';  // 华为
+        } else {
+            return $bucket . '.obs.' . $region . '.ctyun.cn';  // 天翼
+        }
+
+
     }
     }
 
 
     /**
     /**

+ 32 - 83
crmeb/crmeb/services/upload/storage/Obs.php

@@ -160,97 +160,18 @@ class Obs extends BaseUpload
         }
         }
         $this->storageRegion = $region;
         $this->storageRegion = $region;
         $app = $this->app();
         $app = $this->app();
-        //检测桶
-        try {
-            $app->headBucket($name, $region);
-        } catch (\Throwable $e) {
-            //桶不存在返回404
-            if (strstr('404', $e->getMessage())) {
-                return $this->setError('COS:' . $e->getMessage());
-            }
-        }
         //创建桶
         //创建桶
         try {
         try {
-            $res = $app->createBucket($name, $region, $acl);
+            $app->createBucket($name, $region, $acl);
         } catch (\Throwable $e) {
         } catch (\Throwable $e) {
-            if (strstr('[curl] 6', $e->getMessage())) {
-                return $this->setError('COS:无效的区域!!');
-            } else if (strstr('Access Denied.', $e->getMessage())) {
-                return $this->setError('COS:无权访问');
-            }
             return $this->setError('COS:' . $e->getMessage());
             return $this->setError('COS:' . $e->getMessage());
         }
         }
-        return $res;
+        return true;
     }
     }
 
 
     public function getRegion()
     public function getRegion()
     {
     {
-        return [
-            [
-                'value' => 'oos-hazz',
-                'label' => '郑州'
-            ],
-            [
-                'value' => 'oos-lnsy',
-                'label' => '沈阳'
-            ],
-            [
-                'value' => 'oos-sccd',
-                'label' => '四川成都'
-            ],
-            [
-                'value' => 'oos-xjwlmq',
-                'label' => '乌鲁木齐'
-            ],
-            [
-                'value' => 'oos-xjwlmq',
-                'label' => '乌鲁木齐'
-            ],
-            [
-                'value' => 'oos-gslz',
-                'label' => '甘肃兰州'
-            ],
-            [
-                'value' => 'oos-sdqd',
-                'label' => '山东青岛'
-            ],
-            [
-                'value' => 'oos-gzgy',
-                'label' => '贵州贵阳'
-            ],
-            [
-                'value' => 'oos-hbwh',
-                'label' => '湖北武汉'
-            ],
-            [
-                'value' => 'oos-xzls',
-                'label' => '西藏拉萨'
-            ],
-            [
-                'value' => 'oos-hbwh',
-                'label' => '湖北武汉'
-            ],
-            [
-                'value' => 'oos-ahwh',
-                'label' => '安徽芜湖'
-            ],
-            [
-                'value' => 'oos-gdsz',
-                'label' => '广东深圳'
-            ],
-            [
-                'value' => 'oos-jssz',
-                'label' => '江苏苏州'
-            ],
-            [
-                'value' => 'oos-sh2',
-                'label' => '上海2'
-            ],
-            [
-                'value' => 'cn-snxy1',
-                'label' => '西安2'
-            ]
-        ];
+        return $this->app()->getRegion();
     }
     }
 
 
     public function deleteBucket(string $name, string $region = '')
     public function deleteBucket(string $name, string $region = '')
@@ -263,9 +184,37 @@ class Obs extends BaseUpload
         }
         }
     }
     }
 
 
+    public function getDomian($name, $region)
+    {
+        try {
+            $res = $this->app()->GetBucketDomain($name, $region);
+            if ($res) {
+                $domainRules = $res->toArray()['ListBucketCustomDomainsResult '];
+                return array_column($domainRules, 'DomainName');
+            } else {
+                return [];
+            }
+
+        } catch (\Throwable $e) {
+        }
+        return [];
+    }
+
     public function bindDomian(string $name, string $domain, string $region = null)
     public function bindDomian(string $name, string $domain, string $region = null)
     {
     {
-        // TODO: Implement bindDomian() method.
+        $parseDomin = parse_url($domain);
+        try {
+            $this->app()->putBucketDomain($name, '', [
+                'domainname' => $parseDomin['host'],
+            ]);
+            return true;
+        } catch (\Throwable $e) {
+            if ($message = $this->setMessage($e->getMessage())) {
+                return $this->setError($message);
+            }
+            return $this->setError($e->getMessage());
+        }
+        return false;
     }
     }
 
 
     public function setBucketCors(string $name, string $region)
     public function setBucketCors(string $name, string $region)

+ 6 - 15
crmeb/crmeb/services/upload/storage/Tyoss.php

@@ -135,7 +135,8 @@ class Tyoss extends BaseUpload
             'secretKey' => $this->secretKey,
             'secretKey' => $this->secretKey,
             'region' => $this->storageRegion ?: 'oos-hazz',
             'region' => $this->storageRegion ?: 'oos-hazz',
             'bucket' => $this->storageName,
             'bucket' => $this->storageName,
-            'uploadUrl' => $this->uploadUrl
+            'uploadUrl' => $this->uploadUrl,
+            'type' => 'ty'
         ]);
         ]);
         return $this->handle;
         return $this->handle;
     }
     }
@@ -160,24 +161,10 @@ class Tyoss extends BaseUpload
         }
         }
         $this->storageRegion = $region;
         $this->storageRegion = $region;
         $app = $this->app();
         $app = $this->app();
-        //检测桶
-        try {
-            $app->headBucket($name, $region);
-        } catch (\Throwable $e) {
-            //桶不存在返回404
-            if (strstr('404', $e->getMessage())) {
-                return $this->setError('COS:' . $e->getMessage());
-            }
-        }
         //创建桶
         //创建桶
         try {
         try {
             $res = $app->createBucket($name, $region, $acl);
             $res = $app->createBucket($name, $region, $acl);
         } catch (\Throwable $e) {
         } catch (\Throwable $e) {
-            if (strstr('[curl] 6', $e->getMessage())) {
-                return $this->setError('COS:无效的区域!!');
-            } else if (strstr('Access Denied.', $e->getMessage())) {
-                return $this->setError('COS:无权访问');
-            }
             return $this->setError('COS:' . $e->getMessage());
             return $this->setError('COS:' . $e->getMessage());
         }
         }
         return $res;
         return $res;
@@ -245,6 +232,10 @@ class Tyoss extends BaseUpload
             [
             [
                 'value' => 'oos-sh2',
                 'value' => 'oos-sh2',
                 'label' => '上海2'
                 'label' => '上海2'
+            ],
+            [
+                'value' => 'cn-snxy1',
+                'label' => '西安2'
             ]
             ]
         ];
         ];
     }
     }