作者 lyh

gx

... ... @@ -446,26 +446,16 @@ if (!function_exists('getFileUrl')) {
*/
function getFileUrl($path,$location = 1){
if(is_array($path)){
foreach ($hash as $v){
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){
if($location == 1){
$cos = config('filesystems.disks.cos');
$cosCdn = $cos['cdn'];
$url = $cosCdn.'/upload'.$info['path'];
}else{
$url = url('upload'.$info['path']);
}
$url = $cosCdn.$path['path'];
}else{
$url = url($hash);
$url = url($path['path']);
}
}
return $url;
... ...