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 */ 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; 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']) { 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..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,7 +371,13 @@ class Client extends BaseClient */ 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'; // 天翼 + } + + } /** diff --git a/crmeb/crmeb/services/upload/storage/Obs.php b/crmeb/crmeb/services/upload/storage/Obs.php index 270eec724..f88eb699b 100644 --- a/crmeb/crmeb/services/upload/storage/Obs.php +++ b/crmeb/crmeb/services/upload/storage/Obs.php @@ -160,97 +160,18 @@ 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); + $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() { - 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 +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) { - // 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) diff --git a/crmeb/crmeb/services/upload/storage/Tyoss.php b/crmeb/crmeb/services/upload/storage/Tyoss.php index aa0aaef96..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; } @@ -160,24 +161,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 +232,10 @@ class Tyoss extends BaseUpload [ 'value' => 'oos-sh2', 'label' => '上海2' + ], + [ + 'value' => 'cn-snxy1', + 'label' => '西安2' ] ]; }