diff --git a/app/Events/BusinessOrdersUpdate.php b/app/Events/BusinessOrdersUpdate.php index 8ddb52d..b44823c 100644 --- a/app/Events/BusinessOrdersUpdate.php +++ b/app/Events/BusinessOrdersUpdate.php @@ -28,11 +28,7 @@ class BusinessOrdersUpdate */ public function __construct($item, $num) { - if (is_array($item)) { - $this->businessGoods = $item; - } else { - $this->businessGoods = $item->toArray(); - } + $this->businessGoods = $item->toArray(); $this->num = $num; $this->updateStock(); } @@ -41,10 +37,6 @@ class BusinessOrdersUpdate { try { $this->goodsSku = GoodsSku::query() - ->with([ - 'combinationGoods', - 'combinationGoods.goodsSkuItem:id,external_sku_id', - ]) ->where('external_sku_id', $this->businessGoods['external_sku_id']) ->first(); } catch (\Exception $e) { @@ -54,10 +46,6 @@ class BusinessOrdersUpdate if ($this->goodsSku) { $this->goodsSku->stock += $this->num; $this->goodsSku->save(); - foreach ($this->goodsSku->combinationGoods as $item) { - $this->businessGoods['external_sku_id'] = $item['goodsSkuItem']['external_sku_id']; - event(new BusinessOrdersUpdate($this->businessGoods, 0 - $item['item_num'])); - } } } diff --git a/app/Http/Controllers/Goods/GoodsSkusController.php b/app/Http/Controllers/Goods/GoodsSkusController.php index 0911db1..e7b946b 100644 --- a/app/Http/Controllers/Goods/GoodsSkusController.php +++ b/app/Http/Controllers/Goods/GoodsSkusController.php @@ -53,7 +53,7 @@ class GoodsSkusController extends Controller }]) ->where('is_combination', 0) ->orderByDesc('stock') - ->paginate(10); + ->paginate($request->get('per_page')); $fields = implode(',', [ 'shop_id', 'external_sku_id',