From 05a86b9ff15194dcf85f5046374012e7901bf35c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=9D=99?= Date: Wed, 8 Dec 2021 15:41:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=95=86=E5=93=81=E5=B7=B2?= =?UTF-8?q?=E4=B8=8B=E6=9E=B6=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Http/Controllers/ShoppingCartItemController.php | 4 ++-- app/Exceptions/ProductOfflineException.php | 11 +++++++++++ resources/lang/zh_CN.json | 1 - 3 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 app/Exceptions/ProductOfflineException.php diff --git a/app/Endpoint/Api/Http/Controllers/ShoppingCartItemController.php b/app/Endpoint/Api/Http/Controllers/ShoppingCartItemController.php index c2cdc90c..b46a2c85 100644 --- a/app/Endpoint/Api/Http/Controllers/ShoppingCartItemController.php +++ b/app/Endpoint/Api/Http/Controllers/ShoppingCartItemController.php @@ -3,7 +3,7 @@ namespace App\Endpoint\Api\Http\Controllers; use App\Endpoint\Api\Http\Resources\ShoppingCartItemResource; -use App\Exceptions\BizException; +use App\Exceptions\ProductOfflineException; use App\Models\ProductSku; use Illuminate\Http\Request; @@ -38,7 +38,7 @@ class ShoppingCartItemController extends Controller $sku = ProductSku::whereRelation('category', 'is_show', true)->online()->find($input['sku_id']); if ($sku === null) { - throw new BizException(__('Product has been removed')); + throw new ProductOfflineException(); } $item = $request->user()->shoppingCartItems()->firstOrCreate([ diff --git a/app/Exceptions/ProductOfflineException.php b/app/Exceptions/ProductOfflineException.php new file mode 100644 index 00000000..0e872059 --- /dev/null +++ b/app/Exceptions/ProductOfflineException.php @@ -0,0 +1,11 @@ +