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.

38 lines
877 B

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. <?php
  2. namespace App\Model\v3;
  3. use App\Constants\v3\OssThumbnail;
  4. use App\Model\Model;
  5. use App\Service\v3\Interfaces\AttachmentServiceInterface;
  6. use Hyperf\Database\Model\SoftDeletes;
  7. use Hyperf\Di\Annotation\Inject;
  8. class GoodsBanner extends Model
  9. {
  10. /**
  11. * @Inject
  12. * @var AttachmentServiceInterface
  13. */
  14. protected $attachmentService;
  15. use SoftDeletes;
  16. protected $table = 'lanzu_goods_banners';
  17. protected $appends = [
  18. 'banner_url',
  19. ];
  20. public function getBannerUrlAttribute()
  21. {
  22. // $url = $this->attributes['path'];
  23. // if(strripos($url,"http") === false){
  24. // return config('alioss.img_host').'/'.$url;
  25. // }else{
  26. // return $url;
  27. // }
  28. return $this->attachmentService->switchImgToAliOss($this->attributes['path'], OssThumbnail::THUMBNAIL_600_Q90);
  29. }
  30. }