|
...
|
...
|
@@ -419,16 +419,26 @@ if (!function_exists('getImageUrl')) { |
|
|
|
* @method :post
|
|
|
|
* @time :2023/7/20 16:46
|
|
|
|
*/
|
|
|
|
function getImageUrl($path,$location = 1){
|
|
|
|
if(is_array($path)){
|
|
|
|
foreach ($path as $v){
|
|
|
|
function getImageUrl($hash){
|
|
|
|
if(is_array($hash)){
|
|
|
|
foreach ($hash as $v){
|
|
|
|
$url[] = getImageUrl($v);
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
if($location == 1){
|
|
|
|
$cos = config('filesystems.disks.cos');
|
|
|
|
$cosCdn = $cos['cdn'];
|
|
|
|
$url = $cosCdn.$path;
|
|
|
|
$imageModel = new Image();
|
|
|
|
if (strpos($hash, '.') !== false) {
|
|
|
|
$info = $imageModel->read(['path'=>['like','%'.$hash.'%']]);
|
|
|
|
}else{
|
|
|
|
$info = $imageModel->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']);
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
$url = url($path);
|
|
|
|
}
|
|
...
|
...
|
@@ -436,7 +446,6 @@ if (!function_exists('getImageUrl')) { |
|
|
|
return $url;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!function_exists('getFileUrl')) {
|
|
|
|
/**
|
|
|
|
* @remark :获取文件链接
|
|
...
|
...
|
@@ -445,18 +454,28 @@ if (!function_exists('getFileUrl')) { |
|
|
|
* @method :post
|
|
|
|
* @time :2023/7/20 16:46
|
|
|
|
*/
|
|
|
|
function getFileUrl($path,$location = 1){
|
|
|
|
if(is_array($path)){
|
|
|
|
foreach ($path as $v){
|
|
|
|
function getFileUrl($hash){
|
|
|
|
if(is_array($hash)){
|
|
|
|
foreach ($hash as $v){
|
|
|
|
$url[] = getFileUrl($v);
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
if($location == 1){
|
|
|
|
$cos = config('filesystems.disks.cos');
|
|
|
|
$cosCdn = $cos['cdn'];
|
|
|
|
$url = $cosCdn.$path['path'];
|
|
|
|
$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.'/upload'.$info['path'];
|
|
|
|
}else{
|
|
|
|
$url = url('upload'.$info['path']);
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
$url = url($path['path']);
|
|
|
|
$url = $hash;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $url;
|
...
|
...
|
|