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

This commit is contained in:
From-wh 2023-06-07 18:16:30 +08:00
commit bd060d2b27
7 changed files with 57 additions and 107 deletions

View File

@ -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 */

View File

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

View File

@ -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']) {

View File

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

View File

@ -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'; // 天翼
}
}
/**

View File

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

View File

@ -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'
]
];
}