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.

37 lines
866 B

5 years ago
5 years ago
5 years ago
5 years ago
6 years ago
6 years ago
5 years ago
6 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. * @var AttachmentServiceInterface
  12. */
  13. protected $attachmentService;
  14. use SoftDeletes;
  15. protected $table = 'lanzu_goods_banners_new';
  16. protected $appends = [
  17. 'banner_url',
  18. ];
  19. public function getBannerUrlAttribute()
  20. {
  21. // $url = $this->attributes['path'];
  22. // if(strripos($url,"http") === false){
  23. // return config('alioss.img_host').'/'.$url;
  24. // }else{
  25. // return $url;
  26. // }
  27. return $this->attachmentService->switchImgToAliOss($this->attributes['path'], OssThumbnail::THUMBNAIL_600_Q90);
  28. }
  29. }