diff --git a/beike/Shop/Http/Controllers/ProductController.php b/beike/Shop/Http/Controllers/ProductController.php index e186b1b9..0889938f 100644 --- a/beike/Shop/Http/Controllers/ProductController.php +++ b/beike/Shop/Http/Controllers/ProductController.php @@ -19,13 +19,6 @@ class ProductController extends Controller public function show(Request $request, Product $product) { $product = ProductRepo::getProductDetail($product); - if ($product->active == 0) { - $data = [ - 'product' => (new ProductDetail($product))->jsonSerialize(), - 'error' => trans('product.has_been_inactive') - ]; - return view('product', $data); - } $data = [ 'product' => (new ProductDetail($product))->jsonSerialize(), ]; diff --git a/beike/Shop/Http/Resources/ProductDetail.php b/beike/Shop/Http/Resources/ProductDetail.php index daf10a6c..f70cc0b3 100644 --- a/beike/Shop/Http/Resources/ProductDetail.php +++ b/beike/Shop/Http/Resources/ProductDetail.php @@ -36,6 +36,7 @@ class ProductDetail extends JsonResource 'variables' => $this->decodeVariables($this->variables), 'skus' => SkuDetail::collection($this->skus)->jsonSerialize(), 'in_wishlist' => $this->inCurrentWishlist->id ?? 0, + 'active' => (bool)$this->active, ]; }