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(['下架', '在售', '预警'])],