新增工具方法
This commit is contained in:
parent
04b491621e
commit
9c1eb59961
@ -1,6 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace catcher;
|
namespace catcher;
|
||||||
|
|
||||||
|
use catcher\exceptions\FailedException;
|
||||||
|
use think\file\UploadedFile;
|
||||||
use think\helper\Str;
|
use think\helper\Str;
|
||||||
|
|
||||||
class Utils
|
class Utils
|
||||||
@ -49,6 +51,29 @@ class Utils
|
|||||||
}
|
}
|
||||||
|
|
||||||
return array_merge($search, $params);
|
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) {
|
||||||
|
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('Driver [%s] Not Supported.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user