From ec7704bbb2fdb8962e53bc2896cae3826c98c46d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=B8=96=E7=95=8C?= <642747453@qq.com> Date: Tue, 9 Aug 2022 10:57:03 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20#10000=20=E5=AF=BC=E5=85=A5=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Goods/GoodsSkusController.php | 6 ++++-- app/Imports/GoodsSkusImport.php | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/Goods/GoodsSkusController.php b/app/Http/Controllers/Goods/GoodsSkusController.php index 664e99b..9e6e175 100644 --- a/app/Http/Controllers/Goods/GoodsSkusController.php +++ b/app/Http/Controllers/Goods/GoodsSkusController.php @@ -333,8 +333,10 @@ class GoodsSkusController extends Controller ]; } try { - $collection = Excel::import(new GoodsSkusImport(), $request->file('goodsSkus')); - $this->setAfterUpdate($collection->toArray()); + $import = new GoodsSkusImport(); + $path = $request->file('goodsSkus'); + Excel::import($import, $path); + $this->setAfterUpdate(''); $this->addLog(0, 'import'); } catch (ValidationException $exception) { $this->setValidatorFailResponse($exception->validator->getMessageBag()->getMessages()); diff --git a/app/Imports/GoodsSkusImport.php b/app/Imports/GoodsSkusImport.php index 6ca3402..639aa51 100644 --- a/app/Imports/GoodsSkusImport.php +++ b/app/Imports/GoodsSkusImport.php @@ -33,7 +33,7 @@ class GoodsSkusImport implements ToCollection, SkipsEmptyRows '*.0' => ['required', 'string', 'max:255'], '*.1' => ['required', 'string', 'max:255', 'exists:goods_types,name'], '*.2' => ['string', 'max:255', 'exists:goods_brands,name'], - '*.3' => ['required', 'alpha_dash', 'max:32', 'unique:goods,goods_code'], + '*.3' => ['required', 'alpha_dash', 'max:32'], '*.4' => ['required', 'string', 'max:255'], '*.5' => ['required', 'distinct', 'alpha_dash', 'max:32'], '*.6' => ['required', 'string', Rule::in(['下架', '在售', '预警'])],