移除方法

This commit is contained in:
JaguarJack 2020-04-29 09:02:43 +08:00
parent 64c03bdfd3
commit f8fb57c9c6
2 changed files with 25 additions and 27 deletions

View File

@ -61,7 +61,7 @@ class CatchUpload
$path = Filesystem::disk($this->getDriver())->putFile($this->getPath(), $file);
if ($path) {
$url = Utils::getCloudDomain($this->getDriver()) . $path;
$url = self::getCloudDomain($this->getDriver()) . $path;
Attachments::create(array_merge([
'path' => $path,
@ -261,4 +261,28 @@ class CatchUpload
], 'filesystem');
}
}
/**
* 获取云存储的域名
*
* @time 2020年01月25日
* @param $driver
* @return string
*/
public static function getCloudDomain($driver): ?string
{
$driver = \config('filesystem.disks.' . $driver);
switch ($driver['type']) {
case CatchUpload::QIQNIU:
case CatchUpload::LOCAL:
return $driver['domain'];
case CatchUpload::OSS:
return $driver['end_point'];
case CatchUpload::QCLOUD:
return $driver['cdn'];
default:
throw new FailedException(sprintf('Driver [%s] Not Supported.', $driver));
}
}
}

View File

@ -1,8 +1,6 @@
<?php
namespace catcher;
use catcher\exceptions\FailedException;
use think\file\UploadedFile;
use think\helper\Str;
class Utils
@ -52,28 +50,4 @@ class Utils
return array_merge($search, $params);
}
/**
* 获取云存储的域名
*
* @time 2020年01月25日
* @param $driver
* @return string
*/
public static function getCloudDomain($driver): ?string
{
$driver = \config('filesystem.disks.' . $driver);
switch ($driver['type']) {
case CatchUpload::QIQNIU:
case CatchUpload::LOCAL:
return $driver['domain'];
case CatchUpload::OSS:
return $driver['end_point'];
case CatchUpload::QCLOUD:
return $driver['cdn'];
default:
throw new FailedException(sprintf('Driver [%s] Not Supported.', $driver));
}
}
}