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.

27 lines
720 B

  1. <?php
  2. namespace App\Model\v3;
  3. use App\Constants\v3\OssThumbnail;
  4. use App\Model\Model;
  5. use Hyperf\Database\Model\Builder;
  6. use Hyperf\Database\Model\SoftDeletes;
  7. class GoodsActivityBanner extends Model
  8. {
  9. use SoftDeletes;
  10. protected $table = 'lanzu_goods_activity_banners';
  11. protected $appends = [
  12. 'banner_url',
  13. ];
  14. public function getBannerUrlAttribute()
  15. {
  16. if ($this->attributes['type'] == 1) {
  17. return $this->attachmentService->switchImgToAliOss($this->attributes['path'], OssThumbnail::THUMBNAIL_600_Q90);
  18. } elseif ($this->attributes['type'] == 2) {
  19. return $this->attachmentService->switchImgToAliOss($this->attributes['path']);
  20. }
  21. }
  22. }