Browse Source

商品 banner 区分视频 图片

master
Lemon 5 years ago
parent
commit
b3f78a77b1
  1. 10
      app/Model/v3/GoodsActivityBanner.php
  2. 13
      app/Model/v3/GoodsBanner.php

10
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']);
}
}
}

13
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']);
}
}
}
Loading…
Cancel
Save