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.
39 lines
881 B
39 lines
881 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_new';
|
|
|
|
protected $appends = [
|
|
'banner_url',
|
|
];
|
|
|
|
|
|
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);
|
|
}
|
|
}
|