|
@@ -239,15 +239,22 @@ class BaseController extends Controller |
|
@@ -239,15 +239,22 @@ class BaseController extends Controller |
|
239
|
* @time :2023/7/20 16:46
|
239
|
* @time :2023/7/20 16:46
|
|
240
|
*/
|
240
|
*/
|
|
241
|
public function getImageUrl($hash){
|
241
|
public function getImageUrl($hash){
|
|
242
|
- $imageModel = new Image();
|
|
|
|
243
|
- $info = $imageModel->read(['hash'=>$hash]);
|
|
|
|
244
|
- $url = '';
|
|
|
|
245
|
- if($info !== false){
|
|
|
|
246
|
- if($info['is_cos'] == 1){
|
|
|
|
247
|
- $cos = new CosService();
|
|
|
|
248
|
- $url = $cos->getImageUrl($info['path']);
|
242
|
+ if(is_array($hash)){
|
|
|
|
243
|
+ foreach ($hash as $k => $v){
|
|
|
|
244
|
+ $url[] = $this->getImageUrl($v);
|
|
|
|
245
|
+ }
|
|
|
|
246
|
+ }else{
|
|
|
|
247
|
+ $imageModel = new Image();
|
|
|
|
248
|
+ $info = $imageModel->read(['hash'=>$hash]);
|
|
|
|
249
|
+ if(!empty($info)){
|
|
|
|
250
|
+ if($info['is_cos'] == 1){
|
|
|
|
251
|
+ $cos = new CosService();
|
|
|
|
252
|
+ $url = $cos->getImageUrl($info['path']);
|
|
|
|
253
|
+ }else{
|
|
|
|
254
|
+ $url = url('a/image/'.$info['hash']);
|
|
|
|
255
|
+ }
|
|
249
|
}else{
|
256
|
}else{
|
|
250
|
- $url = url('b/image/'.$info['hash']);
|
257
|
+ $url = $hash;
|
|
251
|
}
|
258
|
}
|
|
252
|
}
|
259
|
}
|
|
253
|
return $url;
|
260
|
return $url;
|
|
@@ -267,7 +274,7 @@ class BaseController extends Controller |
|
@@ -267,7 +274,7 @@ class BaseController extends Controller |
|
267
|
$cos = new CosService();
|
274
|
$cos = new CosService();
|
|
268
|
$url = $cos->getImageUrl($info['path']);
|
275
|
$url = $cos->getImageUrl($info['path']);
|
|
269
|
}else{
|
276
|
}else{
|
|
270
|
- $url = url('b/file_hash/'.$info['hash']);
|
277
|
+ $url = url('a/file/'.$info['hash']);
|
|
271
|
}
|
278
|
}
|
|
272
|
return $url;
|
279
|
return $url;
|
|
273
|
}
|
280
|
}
|