diff --git a/app/Model/v3/Goods.php b/app/Model/v3/Goods.php index 2c89408..84daf35 100644 --- a/app/Model/v3/Goods.php +++ b/app/Model/v3/Goods.php @@ -12,6 +12,7 @@ use Hyperf\Database\Model\SoftDeletes; use Hyperf\Utils\ApplicationContext; use Hyperf\Di\Annotation\Inject; use App\Constants\v3\Goods as GoodsConstants; +use Hyperf\Utils\Collection; /** */ @@ -53,6 +54,7 @@ class Goods extends Model 'cart_num', 'is_effective', 'noneffective_note', + 'details_imgs_url', ]; protected function boot(): void @@ -108,6 +110,16 @@ class Goods extends Model return ''; } + public function getDetailsImgsUrlAttribute() + { + $details_imgs = $this->details_imgs; + $img_host = config('alioss.img_host').'/'; + + return collect($details_imgs)->map(function($item) use ($img_host){ + return $img_host . $item; + }); + } + public function store() { return $this->belongsTo(Store::class, 'store_id', 'id');