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.
|
|
<?php
namespace App\Model\v3;
use App\Constants\v3\OssThumbnail;use App\Model\Model;use Hyperf\Database\Model\Builder;use Hyperf\Database\Model\SoftDeletes;use App\Service\v3\Interfaces\AttachmentServiceInterface;use Hyperf\Di\Annotation\Inject;class GoodsActivityBanner extends Model{ /** * @Inject * @var AttachmentServiceInterface */ protected $attachmentService; use SoftDeletes; protected $table = 'lanzu_goods_activity_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']); } }}
|