From b3f78a77b1462e1a9dbe067ef9a1af4e36f7ee47 Mon Sep 17 00:00:00 2001 From: Lemon <15040771@qq.com> Date: Fri, 18 Sep 2020 16:01:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=20banner=20=E5=8C=BA?= =?UTF-8?q?=E5=88=86=E8=A7=86=E9=A2=91=20=E5=9B=BE=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Model/v3/GoodsActivityBanner.php | 10 +++++----- app/Model/v3/GoodsBanner.php | 13 +++++-------- 2 files changed, 10 insertions(+), 13 deletions(-) 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