WIN-2308041133\Administrator 3 months ago
parent
commit
4457c05399
1 changed files with 7 additions and 3 deletions
  1. 7 3
      app/common/repositories/store/order/StoreOrderRepository.php

+ 7 - 3
app/common/repositories/store/order/StoreOrderRepository.php

@@ -3227,10 +3227,14 @@ class StoreOrderRepository extends BaseRepository
 //
 //            }
             foreach ($order['orderProduct'] as $k => $v){
-                var_dump($data);
-                var_dump($data[$v['product_id']]['num']);die();
+                $num=0;
                 $cart_info = StoreCart::where(['cart_id' => $v['cart_id'], 'product_id' => $v['product_id']])->find();
-                $verify_num = bcadd($cart_info['verify_num'], $data[$v['product_id']]['num'], 0);
+                foreach ($data as $vv){
+                    if ($vv['product_id'] == $v['product_id']){
+                        $num = $vv['num'];
+                    }
+                }
+                $verify_num = bcadd($cart_info['verify_num'], $num, 0);
                 if ($verify_num > $cart_info['cart_num']) {
                     throw new ValidateException('核销数量不能大于购买数量');
                 }