diff --git a/app/Model/v3/GoodsBanner.php b/app/Model/v3/GoodsBanner.php index 598e031..37d33cd 100644 --- a/app/Model/v3/GoodsBanner.php +++ b/app/Model/v3/GoodsBanner.php @@ -10,4 +10,19 @@ class GoodsBanner extends Model { use SoftDeletes; protected $table = 'lanzu_goods_banners'; + + protected $appends = [ + 'banner_url', + ]; + + + public function getBannerUrlAttribute() + { + $url = $this->attributes['path']; + if(strripos($url,"http") === false){ + return config('alioss.img_host').'/'.$url; + }else{ + return $url; + } + } } \ No newline at end of file diff --git a/app/Service/v3/Implementations/CategoryService.php b/app/Service/v3/Implementations/CategoryService.php index b7195e2..e2aeda0 100644 --- a/app/Service/v3/Implementations/CategoryService.php +++ b/app/Service/v3/Implementations/CategoryService.php @@ -60,7 +60,7 @@ class CategoryService implements CategoryServiceInterface $value = json_decode($category, true); $iconUrl = $value['icon']; if(strripos($iconUrl,"http") === false){ - $iconUrl = config('alioss.img_host').$value['icon']; + $iconUrl = config('alioss.img_host').'/'.$value['icon']; } $iconUrl = $iconUrl . OssThumbnail::THUMBNAIL_100_Q50; $returnData[] = ['id' => $key, 'icon' => $iconUrl , 'name' => $value['name']];