You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
865 B
36 lines
865 B
<?php
|
|
|
|
namespace App\Model\v3;
|
|
|
|
use App\Constants\v3\OssThumbnail;
|
|
use App\Model\Model;
|
|
use App\Service\v3\Interfaces\AttachmentServiceInterface;
|
|
use Hyperf\Database\Model\SoftDeletes;
|
|
use Hyperf\Di\Annotation\Inject;
|
|
|
|
class GoodsBanner extends Model
|
|
{
|
|
|
|
/**
|
|
* @Inject
|
|
* @var AttachmentServiceInterface
|
|
*/
|
|
protected $attachmentService;
|
|
|
|
use SoftDeletes;
|
|
protected $table = 'lanzu_goods_banners';
|
|
|
|
protected $appends = [
|
|
'banner_url',
|
|
];
|
|
|
|
|
|
public function getBannerUrlAttribute()
|
|
{
|
|
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']);
|
|
}
|
|
}
|
|
}
|