From df8f56ef6f5923beb784d141c0542a6f26953b83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=9D=99?= Date: Fri, 10 Dec 2021 10:45:46 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E5=95=86=E5=93=81=20SPU=20?= =?UTF-8?q?=E4=B8=AD=E6=97=A0=E6=95=88=E7=9A=84=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/ProductSpu.php | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/app/Models/ProductSpu.php b/app/Models/ProductSpu.php index ebfa47a8..45025027 100644 --- a/app/Models/ProductSpu.php +++ b/app/Models/ProductSpu.php @@ -66,31 +66,4 @@ class ProductSpu extends Model { return $this->skus()->exists(); } - - /** - * 确认给定的 SKU 是否有效 - * - * @param \App\Models\ProductSku $sku - * @return bool - */ - public function isValidProductSku(ProductSku $sku): bool - { - if ($this->getKey() !== $sku->spu_id) { - return false; - } - - if (count($specs = (array) $sku->specs) === $this->specs->count()) { - foreach ($this->specs as $spec) { - $key = $spec->getKey(); - - if (! array_key_exists($key, $specs) || ! in_array($specs[$key], $spec->items)) { - return false; - } - } - - return true; - } - - return false; - } }