|
|
@ -2,12 +2,20 @@ |
|
|
|
|
|
|
|
|
namespace App\Model\v3; |
|
|
namespace App\Model\v3; |
|
|
|
|
|
|
|
|
|
|
|
use App\Constants\v3\OssThumbnail; |
|
|
use App\Model\Model; |
|
|
use App\Model\Model; |
|
|
use Hyperf\Database\Model\Builder; |
|
|
|
|
|
|
|
|
use App\Service\v3\Interfaces\AttachmentServiceInterface; |
|
|
use Hyperf\Database\Model\SoftDeletes; |
|
|
use Hyperf\Database\Model\SoftDeletes; |
|
|
|
|
|
use Hyperf\Di\Annotation\Inject; |
|
|
|
|
|
|
|
|
class GoodsBanner extends Model |
|
|
class GoodsBanner extends Model |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @var AttachmentServiceInterface |
|
|
|
|
|
*/ |
|
|
|
|
|
protected $attachmentService; |
|
|
|
|
|
|
|
|
use SoftDeletes; |
|
|
use SoftDeletes; |
|
|
protected $table = 'lanzu_goods_banners_new'; |
|
|
protected $table = 'lanzu_goods_banners_new'; |
|
|
|
|
|
|
|
|
@ -18,11 +26,13 @@ class GoodsBanner extends Model |
|
|
|
|
|
|
|
|
public function getBannerUrlAttribute() |
|
|
public function getBannerUrlAttribute() |
|
|
{ |
|
|
{ |
|
|
$url = $this->attributes['path']; |
|
|
|
|
|
if(strripos($url,"http") === false){ |
|
|
|
|
|
return config('alioss.img_host').'/'.$url; |
|
|
|
|
|
}else{ |
|
|
|
|
|
return $url; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// $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); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |