diff --git a/app/Model/v3/GoodsActivityBanner.php b/app/Model/v3/GoodsActivityBanner.php index 8555f3e..223005f 100644 --- a/app/Model/v3/GoodsActivityBanner.php +++ b/app/Model/v3/GoodsActivityBanner.php @@ -2,6 +2,7 @@ namespace App\Model\v3; +use App\Constants\v3\OssThumbnail; use App\Model\Model; use Hyperf\Database\Model\Builder; use Hyperf\Database\Model\SoftDeletes; @@ -18,11 +19,10 @@ class GoodsActivityBanner extends Model public function getBannerUrlAttribute() { - $url = $this->attributes['path']; - if(strripos($url,"http") === false){ - return config('alioss.img_host').'/'.$url; - }else{ - return $url; + if ($this->attributes['type'] == 1) { + return $this->attachmentService->switchImgToAliOss($this->attributes['path'], OssThumbnail::THUMBNAIL_600_Q90); + } elseif ($this->attributes['type'] == 2) { + return $this->attachmentService->switchImgToAliOss($this->attributes['path']); } } } \ No newline at end of file diff --git a/app/Model/v3/GoodsBanner.php b/app/Model/v3/GoodsBanner.php index 8ca3a22..d0cfa69 100644 --- a/app/Model/v3/GoodsBanner.php +++ b/app/Model/v3/GoodsBanner.php @@ -27,13 +27,10 @@ class GoodsBanner extends Model public function getBannerUrlAttribute() { - // $url = $this->attributes['path']; - // if(strripos($url,"http") === false){ - // return config('alioss.img_host').'/'.$url; - // }else{ - // return $url; - // } - - return $this->attachmentService->switchImgToAliOss($this->attributes['path'], OssThumbnail::THUMBNAIL_600_Q90); + if($this->attributes['type'] == 1){ + return $this->attachmentService->switchImgToAliOss($this->attributes['path'], OssThumbnail::THUMBNAIL_600_Q90); + }elseif ($this->attributes['type'] == 2){ + return $this->attachmentService->switchImgToAliOss($this->attributes['path']); + } } } \ No newline at end of file