From 3fc91fdf9fd0ad1dd0822d5cd316f1e7a1a89c5a Mon Sep 17 00:00:00 2001 From: Gosowong <1329847115@qq.com> Date: Wed, 7 Jun 2023 16:32:37 +0800 Subject: [PATCH 1/5] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E5=8D=8E=E4=B8=BA?= =?UTF-8?q?=E4=BA=91=E5=92=8C=E5=A4=A9=E7=BF=BC=E4=BA=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crmeb/crmeb/services/upload/Upload.php | 1 + .../services/upload/extend/obs/Client.php | 3 +- crmeb/crmeb/services/upload/storage/Obs.php | 106 +++++------------- crmeb/crmeb/services/upload/storage/Tyoss.php | 18 +-- 4 files changed, 37 insertions(+), 91 deletions(-) diff --git a/crmeb/crmeb/services/upload/Upload.php b/crmeb/crmeb/services/upload/Upload.php index 6b26ab177..150fabbf9 100644 --- a/crmeb/crmeb/services/upload/Upload.php +++ b/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\Qiniu * @mixin \crmeb\services\upload\storage\Jdoss + * @mixin \crmeb\services\upload\storage\Tyoss */ class Upload extends BaseManager { diff --git a/crmeb/crmeb/services/upload/extend/obs/Client.php b/crmeb/crmeb/services/upload/extend/obs/Client.php index 9edfdf750..9f1993f37 100644 --- a/crmeb/crmeb/services/upload/extend/obs/Client.php +++ b/crmeb/crmeb/services/upload/extend/obs/Client.php @@ -368,7 +368,8 @@ class Client extends BaseClient */ protected function getRequestUrl(string $bucket, string $region) { - return $bucket . '.obs.' . $region . '.myhuaweicloud.com'; +// return $bucket . '.obs.' . $region . '.myhuaweicloud.com'; // 华为 + return $bucket . '.obs.' . $region . '.ctyun.cn'; // 天翼 } /** diff --git a/crmeb/crmeb/services/upload/storage/Obs.php b/crmeb/crmeb/services/upload/storage/Obs.php index 270eec724..aa0c017f1 100644 --- a/crmeb/crmeb/services/upload/storage/Obs.php +++ b/crmeb/crmeb/services/upload/storage/Obs.php @@ -160,15 +160,6 @@ class Obs extends BaseUpload } $this->storageRegion = $region; $app = $this->app(); - //检测桶 - try { - $app->headBucket($name, $region); - } catch (\Throwable $e) { - //桶不存在返回404 - if (strstr('404', $e->getMessage())) { - return $this->setError('COS:' . $e->getMessage()); - } - } //创建桶 try { $res = $app->createBucket($name, $region, $acl); @@ -185,72 +176,7 @@ class Obs extends BaseUpload 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 = '') @@ -263,9 +189,37 @@ class Obs extends BaseUpload } } + public function getDomian($name, $region) + { + try { + $res = $this->app()->GetBucketDomain($name, $region); + $domainRules = $res->toArray()['ListBucketCustomDomainsResult ']; + return array_column($domainRules, 'Name'); + } catch (\Throwable $e) { + } + return []; + } + public function bindDomian(string $name, string $domain, string $region = null) { - // TODO: Implement bindDomian() method. + $parseDomin = parse_url($domain); + try { + $res = $this->app()->putBucketDomain($name, '', [ + 'domainname' => $parseDomin['host'], + ]); + if (method_exists($res, 'toArray')) { + $res = $res->toArray(); + } + if ($res['RequestId'] ?? null) { + 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) diff --git a/crmeb/crmeb/services/upload/storage/Tyoss.php b/crmeb/crmeb/services/upload/storage/Tyoss.php index aa0aaef96..4c50204fd 100644 --- a/crmeb/crmeb/services/upload/storage/Tyoss.php +++ b/crmeb/crmeb/services/upload/storage/Tyoss.php @@ -160,24 +160,10 @@ class Tyoss extends BaseUpload } $this->storageRegion = $region; $app = $this->app(); - //检测桶 - try { - $app->headBucket($name, $region); - } catch (\Throwable $e) { - //桶不存在返回404 - if (strstr('404', $e->getMessage())) { - return $this->setError('COS:' . $e->getMessage()); - } - } //创建桶 try { $res = $app->createBucket($name, $region, $acl); } 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 $res; @@ -245,6 +231,10 @@ class Tyoss extends BaseUpload [ 'value' => 'oos-sh2', 'label' => '上海2' + ], + [ + 'value' => 'cn-snxy1', + 'label' => '西安2' ] ]; } From 91a20603503d74c40f6e35e3c176d5479712c6f9 Mon Sep 17 00:00:00 2001 From: evoxwht <442384644@qq.com> Date: Wed, 7 Jun 2023 16:34:20 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E6=8B=BC=E5=9B=A2=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../activity/combination/StorePinkServices.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/crmeb/app/services/activity/combination/StorePinkServices.php b/crmeb/app/services/activity/combination/StorePinkServices.php index f17b9193f..9715a4f06 100644 --- a/crmeb/app/services/activity/combination/StorePinkServices.php +++ b/crmeb/app/services/activity/combination/StorePinkServices.php @@ -97,7 +97,7 @@ class StorePinkServices extends BaseServices */ 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'); $res12 = $this->dao->update($kCount['id'], ['stop_time' => $count['add_time'] + 86400, 'k_id' => 0]); $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 { $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 $res = $res1 && $res2; } 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; } @@ -221,10 +221,10 @@ class StorePinkServices extends BaseServices { //查找拼团团员和团长 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']); } else { - $pinkAll = $this->dao->getPinkUserList(['k_id' => $pink['id'], 'is_refund' => 0]); + $pinkAll = $this->dao->getPinkUserList(['k_id' => $pink['id']]); $pinkT = $pink; } $count = count($pinkAll) + 1; From 2f131368d23dca24467d1d267d3f819667a43527 Mon Sep 17 00:00:00 2001 From: Gosowong <1329847115@qq.com> Date: Wed, 7 Jun 2023 17:35:41 +0800 Subject: [PATCH 3/5] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E5=8D=8E=E4=B8=BA?= =?UTF-8?q?=E4=BA=91=E5=9F=9F=E5=90=8D=E7=A9=BA=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../services/upload/extend/obs/Client.php | 12 +++++++-- crmeb/crmeb/services/upload/storage/Obs.php | 27 ++++++++----------- crmeb/crmeb/services/upload/storage/Tyoss.php | 3 ++- 3 files changed, 23 insertions(+), 19 deletions(-) diff --git a/crmeb/crmeb/services/upload/extend/obs/Client.php b/crmeb/crmeb/services/upload/extend/obs/Client.php index 9f1993f37..95b905af0 100644 --- a/crmeb/crmeb/services/upload/extend/obs/Client.php +++ b/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 $type = 'hw'; + /** * Client constructor. * @param array $config @@ -135,6 +137,7 @@ class Client extends BaseClient $this->bucketName = $config['bucket'] ?? ''; $this->region = $config['region'] ?? 'ap-chengdu'; $this->uploadUrl = $config['uploadUrl'] ?? ''; + $this->type = $config['type'] ?? 'hw'; } /** @@ -368,8 +371,13 @@ class Client extends BaseClient */ protected function getRequestUrl(string $bucket, string $region) { -// return $bucket . '.obs.' . $region . '.myhuaweicloud.com'; // 华为 - return $bucket . '.obs.' . $region . '.ctyun.cn'; // 天翼 + if ($this->type == 'hw') { + return $bucket . '.obs.' . $region . '.myhuaweicloud.com'; // 华为 + } else { + return $bucket . '.obs.' . $region . '.ctyun.cn'; // 天翼 + } + + } /** diff --git a/crmeb/crmeb/services/upload/storage/Obs.php b/crmeb/crmeb/services/upload/storage/Obs.php index aa0c017f1..f88eb699b 100644 --- a/crmeb/crmeb/services/upload/storage/Obs.php +++ b/crmeb/crmeb/services/upload/storage/Obs.php @@ -162,16 +162,11 @@ class Obs extends BaseUpload $app = $this->app(); //创建桶 try { - $res = $app->createBucket($name, $region, $acl); + $app->createBucket($name, $region, $acl); } 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 $res; + return true; } public function getRegion() @@ -193,8 +188,13 @@ class Obs extends BaseUpload { try { $res = $this->app()->GetBucketDomain($name, $region); - $domainRules = $res->toArray()['ListBucketCustomDomainsResult ']; - return array_column($domainRules, 'Name'); + if ($res) { + $domainRules = $res->toArray()['ListBucketCustomDomainsResult ']; + return array_column($domainRules, 'DomainName'); + } else { + return []; + } + } catch (\Throwable $e) { } return []; @@ -204,15 +204,10 @@ class Obs extends BaseUpload { $parseDomin = parse_url($domain); try { - $res = $this->app()->putBucketDomain($name, '', [ + $this->app()->putBucketDomain($name, '', [ 'domainname' => $parseDomin['host'], ]); - if (method_exists($res, 'toArray')) { - $res = $res->toArray(); - } - if ($res['RequestId'] ?? null) { - return true; - } + return true; } catch (\Throwable $e) { if ($message = $this->setMessage($e->getMessage())) { return $this->setError($message); diff --git a/crmeb/crmeb/services/upload/storage/Tyoss.php b/crmeb/crmeb/services/upload/storage/Tyoss.php index 4c50204fd..74175be2e 100644 --- a/crmeb/crmeb/services/upload/storage/Tyoss.php +++ b/crmeb/crmeb/services/upload/storage/Tyoss.php @@ -135,7 +135,8 @@ class Tyoss extends BaseUpload 'secretKey' => $this->secretKey, 'region' => $this->storageRegion ?: 'oos-hazz', 'bucket' => $this->storageName, - 'uploadUrl' => $this->uploadUrl + 'uploadUrl' => $this->uploadUrl, + 'type' => 'ty' ]); return $this->handle; } From cdf47b3d65ecef1aa3e8c8dd908bc84bf3ae9abe Mon Sep 17 00:00:00 2001 From: evoxwht <442384644@qq.com> Date: Wed, 7 Jun 2023 17:46:26 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E4=BA=91=E5=AD=98=E5=82=A8=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E7=BC=A9=E7=95=A5=E5=9B=BE=E9=94=99=E8=AF=AF=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crmeb/app/services/other/UploadService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crmeb/app/services/other/UploadService.php b/crmeb/app/services/other/UploadService.php index cd1d0007f..45822ad2c 100644 --- a/crmeb/app/services/other/UploadService.php +++ b/crmeb/app/services/other/UploadService.php @@ -134,7 +134,7 @@ class UploadService /** @var SystemStorageServices $storageServices */ $storageServices = app()->make(SystemStorageServices::class); $storageArr = $storageServices->cacheDriver()->remember('storage_list', function () use ($storageServices) { - return $storageServices->selectList([], 'domain')->toArray(); + return $storageServices->selectList([], 'domain,type')->toArray(); }); foreach ($storageArr as $item) { if ($fileHost == $item['domain']) { From dc32f5a4e31e016d643dfb34f4ebef2583d7cdfb Mon Sep 17 00:00:00 2001 From: evoxwht <442384644@qq.com> Date: Wed, 7 Jun 2023 18:14:14 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E5=B1=95=E7=A4=BA=E5=BC=80=E7=A5=A8=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crmeb/app/adminapi/controller/v1/order/StoreOrder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crmeb/app/adminapi/controller/v1/order/StoreOrder.php b/crmeb/app/adminapi/controller/v1/order/StoreOrder.php index 1de01e8bd..7d6f50e40 100644 --- a/crmeb/app/adminapi/controller/v1/order/StoreOrder.php +++ b/crmeb/app/adminapi/controller/v1/order/StoreOrder.php @@ -465,7 +465,7 @@ class StoreOrder extends AuthController */ 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); } /** @var UserServices $services */