|
...
|
...
|
@@ -239,15 +239,22 @@ class BaseController extends Controller |
|
|
|
* @time :2023/7/20 16:46
|
|
|
|
*/
|
|
|
|
public function getImageUrl($hash){
|
|
|
|
$imageModel = new Image();
|
|
|
|
$info = $imageModel->read(['hash'=>$hash]);
|
|
|
|
$url = '';
|
|
|
|
if($info !== false){
|
|
|
|
if($info['is_cos'] == 1){
|
|
|
|
$cos = new CosService();
|
|
|
|
$url = $cos->getImageUrl($info['path']);
|
|
|
|
if(is_array($hash)){
|
|
|
|
foreach ($hash as $k => $v){
|
|
|
|
$url[] = $this->getImageUrl($v);
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
$imageModel = new Image();
|
|
|
|
$info = $imageModel->read(['hash'=>$hash]);
|
|
|
|
if(!empty($info)){
|
|
|
|
if($info['is_cos'] == 1){
|
|
|
|
$cos = new CosService();
|
|
|
|
$url = $cos->getImageUrl($info['path']);
|
|
|
|
}else{
|
|
|
|
$url = url('a/image/'.$info['hash']);
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
$url = url('b/image/'.$info['hash']);
|
|
|
|
$url = $hash;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $url;
|
|
...
|
...
|
@@ -267,7 +274,7 @@ class BaseController extends Controller |
|
|
|
$cos = new CosService();
|
|
|
|
$url = $cos->getImageUrl($info['path']);
|
|
|
|
}else{
|
|
|
|
$url = url('b/file_hash/'.$info['hash']);
|
|
|
|
$url = url('a/file/'.$info['hash']);
|
|
|
|
}
|
|
|
|
return $url;
|
|
|
|
}
|
...
|
...
|
|