From 2c58a95dd0b1935ad9dd80affdeb00e68dd27713 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E4=B8=96=E7=95=8C?= <642747453@qq.com> Date: Thu, 8 Sep 2022 10:10:18 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20#10000=20=E8=B7=AF=E7=94=B1=E4=BF=AE?= =?UTF-8?q?=E6=94=B9,=E5=BA=93=E5=AD=98=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Imports/InventoryImport.php | 1 + routes/api.php | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Imports/InventoryImport.php b/app/Imports/InventoryImport.php index aaf425e..36a27ef 100644 --- a/app/Imports/InventoryImport.php +++ b/app/Imports/InventoryImport.php @@ -69,6 +69,7 @@ class InventoryImport implements ToCollection, SkipsEmptyRows ->pluck('id') ->toArray(); if ($downSkuIds = array_diff($onSkuIds, $updateIds)) { + GoodsSku::whereIn('id', $onSkuIds)->update(['stock' => 0]); event(new StockUpdateEvent($downSkuIds)); } } diff --git a/routes/api.php b/routes/api.php index 90f31b6..a4925ca 100644 --- a/routes/api.php +++ b/routes/api.php @@ -32,8 +32,6 @@ Route::middleware(['auth:api', 'check.permissions'])->group(function () { Route::resource('goods_skus', 'Goods\GoodsSkusController', ['only' => ['index', 'show', 'update', 'store']]); Route::patch('batch/goods_skus', [GoodsSkusController::class, 'batchUpdate'])->name('goods_sku.batch_update'); Route::patch('single/goods_skus/{id}', [GoodsSkusController::class, 'updateField'])->name('goods_sku.single_update'); - // 盘点导入 - Route::post('inventory/goods_skus', [GoodsSkusController::class, 'inventoryImport'])->name('goods_sku.inventory'); // 店铺 Route::resource('shops', 'Shop\ShopsController', ['only' => ['index', 'store', 'show', 'update', 'destroy']]); Route::get('count/orders/num', [ShopsController::class, 'countOrdersNumWithSkuCode'])->name('goods_sku.orders_num'); @@ -63,3 +61,6 @@ Route::get('shop_platforms', [ShopsController::class, 'getPlatList'])->name('pla // 妙选商城数据推送 Route::post('business', [ShopsController::class, 'business'])->name('shop.put.business'); + +// 盘点导入 +Route::post('inventory/goods_skus', [GoodsSkusController::class, 'inventoryImport'])->name('goods_sku.inventory')->middleware('check.permissions');