正在显示
1 个修改的文件
包含
6 行增加
和
16 行删除
| @@ -446,26 +446,16 @@ if (!function_exists('getFileUrl')) { | @@ -446,26 +446,16 @@ if (!function_exists('getFileUrl')) { | ||
| 446 | */ | 446 | */ |
| 447 | function getFileUrl($path,$location = 1){ | 447 | function getFileUrl($path,$location = 1){ |
| 448 | if(is_array($path)){ | 448 | if(is_array($path)){ |
| 449 | - foreach ($hash as $v){ | 449 | + foreach ($path as $v){ |
| 450 | $url[] = getFileUrl($v); | 450 | $url[] = getFileUrl($v); |
| 451 | } | 451 | } |
| 452 | }else{ | 452 | }else{ |
| 453 | - $fileModel = new File(); | ||
| 454 | - if (strpos($hash, '.') !== false) { | ||
| 455 | - $info = $fileModel->read(['path'=>['like','%'.$hash.'%']]); | ||
| 456 | - }else{ | ||
| 457 | - $info = $fileModel->read(['hash'=>$hash]); | ||
| 458 | - } | ||
| 459 | - if(!empty($info)){ | ||
| 460 | - if($info['is_cos'] == 1){ | ||
| 461 | - $cos = config('filesystems.disks.cos'); | ||
| 462 | - $cosCdn = $cos['cdn']; | ||
| 463 | - $url = $cosCdn.'/upload'.$info['path']; | ||
| 464 | - }else{ | ||
| 465 | - $url = url('upload'.$info['path']); | ||
| 466 | - } | 453 | + if($location == 1){ |
| 454 | + $cos = config('filesystems.disks.cos'); | ||
| 455 | + $cosCdn = $cos['cdn']; | ||
| 456 | + $url = $cosCdn.$path['path']; | ||
| 467 | }else{ | 457 | }else{ |
| 468 | - $url = url($hash); | 458 | + $url = url($path['path']); |
| 469 | } | 459 | } |
| 470 | } | 460 | } |
| 471 | return $url; | 461 | return $url; |
-
请 注册 或 登录 后发表评论