diff --git a/app/admin/controller/store_product/StoreProductController.php b/app/admin/controller/store_product/StoreProductController.php index 83db7147..507a8b36 100644 --- a/app/admin/controller/store_product/StoreProductController.php +++ b/app/admin/controller/store_product/StoreProductController.php @@ -103,23 +103,11 @@ class StoreProductController extends BaseAdminController $warehouse_id = $this->request->post('warehouse_id'); if (count($store_arr) == 1) { $store_id = $store_arr[0]; - foreach ($product_arr as $key => $arr) { - $nums= WarehouseProductStorege::where('warehouse_id',$warehouse_id)->where('product_id',$arr['product_id'])->value('nums'); - if($nums<$arr['stock']){ - return $this->fail('商品ID'.$arr['product_id'].'库存不足'); - } - } foreach ($product_arr as $key => $arr) { Redis::send('store-storage', ['product_arr' => $arr, 'store_id' => $store_id,'stock_type'=>$stock_type, 'admin_id' => $this->adminId,'warehouse_id'=>$warehouse_id]); } } else { foreach ($product_arr as $key => $arr) { - foreach ($product_arr as $key => $arr) { - $nums= WarehouseProductStorege::where('warehouse_id',$warehouse_id)->where('product_id',$arr['product_id'])->value('nums'); - if($nums<$arr['stock']){ - return $this->fail('商品ID'.$arr['product_id'].'库存不足'); - } - } foreach ($store_arr as $k => $store_id) { Redis::send('store-storage', ['product_arr' => $arr, 'store_id' => $store_id,'stock_type'=>$stock_type, 'admin_id' => $this->adminId,'warehouse_id'=>$warehouse_id]); }