|
...
|
...
|
@@ -444,33 +444,24 @@ if (!function_exists('getFileUrl')) { |
|
|
|
* @method :post
|
|
|
|
* @time :2023/7/20 16:46
|
|
|
|
*/
|
|
|
|
function getFileUrl($hash){
|
|
|
|
if(is_array($hash)){
|
|
|
|
foreach ($hash as $v){
|
|
|
|
function getFileUrl($path,$location = 1){
|
|
|
|
if(is_array($path)){
|
|
|
|
foreach ($path as $v){
|
|
|
|
$url[] = getFileUrl($v);
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
$fileModel = new File();
|
|
|
|
if (strpos($hash, '.') !== false) {
|
|
|
|
$info = $fileModel->read(['path'=>['like','%'.$hash.'%']]);
|
|
|
|
}else{
|
|
|
|
$info = $fileModel->read(['hash'=>$hash]);
|
|
|
|
}
|
|
|
|
if(!empty($info)){
|
|
|
|
if($info['is_cos'] == 1){
|
|
|
|
$cos = config('filesystems.disks.cos');
|
|
|
|
$cosCdn = $cos['cdn'];
|
|
|
|
$url = $cosCdn.$info['path'];
|
|
|
|
}else{
|
|
|
|
$url = url($info['path']);
|
|
|
|
}
|
|
|
|
if($location == 1){
|
|
|
|
$cos = config('filesystems.disks.cos');
|
|
|
|
$cosCdn = $cos['cdn'];
|
|
|
|
$url = $cosCdn.$path;
|
|
|
|
}else{
|
|
|
|
$url = $hash;
|
|
|
|
$url = url($path);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $url;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :字符串截取
|
|
|
|
* @name :characterTruncation
|
...
|
...
|
|