WIN-2308041133\Administrator 2 tuần trước cách đây
mục cha
commit
9674e2c45c

+ 9 - 4
app/dao/product/product/StoreProductDao.php

@@ -344,10 +344,15 @@ class StoreProductDao extends BaseDao
         $this->getModel()->where('presale', 1)->where('presale_end_time', '<', time())->update(['is_show' => 0]);
     }
     public function repeatCount(array $producrIds){
-        $a = $this->getModel()->where('product_id','in',$producrIds)->where('is_repeat',1)->count();
-        $sql = $this->getModel()->getLastSql();
-        @file_put_contents("quanju.txt", $sql."sql语句\r\n", 8);
-        return $a;
+        try {
+            $a = $this->getModel()->where('product_id','in',$producrIds)->where('is_repeat',1)->count();
+            $sql = $this->getModel()->getLastSql();
+            @file_put_contents("quanju.txt", $sql."sql语句\r\n", 8);
+            return $a;
+        } catch (\Exception $e) {
+            @file_put_contents("quanju.txt", json_encode($e->getMessage())."-报错内容\r\n", 8);
+            throw $e;
+        }
     }
 
 }

+ 23 - 19
app/services/order/StoreOrderComputedServices.php

@@ -123,29 +123,33 @@ class StoreOrderComputedServices extends BaseServices
 
 
                 $hasRepeat=false;
-                $Repeat = $productServices->repeatCount($productIds);
+                try {
+                    $Repeat = $productServices->repeatCount($productIds);
+                    @file_put_contents("quanju.txt", $Repeat."-复购商品数量\r\n", 8);
 
-                @file_put_contents("quanju.txt", $Repeat."-复购商品数量\r\n", 8);
-
-                if ($Repeat > 0){
-                    $hasRepeat = true;
-                }
-                @file_put_contents("quanju.txt", $hasRepeat."-是否是复购商品\r\n", 8);
+                    if ($Repeat > 0){
+                        $hasRepeat = true;
+                    }
+                    @file_put_contents("quanju.txt", $hasRepeat."-是否是复购商品\r\n", 8);
 
-                if ($hasRepeat) {
-                    // 将所有有会员折扣的商品还原为原价,重新汇总总价
-                    $newTotalPrice = '0';
-                    foreach ($cartInfo as &$cartItem) {
-                        if (isset($cartItem['price_type']) && in_array($cartItem['price_type'], ['level', 'member'])) {
-                            $cartItem['truePrice'] = $cartItem['sum_price'];
-                            $cartItem['vip_truePrice'] = 0;
-                            $cartItem['price_type'] = 'normal';
+                    if ($hasRepeat) {
+                        // 将所有有会员折扣的商品还原为原价,重新汇总总价
+                        $newTotalPrice = '0';
+                        foreach ($cartInfo as &$cartItem) {
+                            if (isset($cartItem['price_type']) && in_array($cartItem['price_type'], ['level', 'member'])) {
+                                $cartItem['truePrice'] = $cartItem['sum_price'];
+                                $cartItem['vip_truePrice'] = 0;
+                                $cartItem['price_type'] = 'normal';
+                            }
+                            $newTotalPrice = bcadd($newTotalPrice, bcmul((string)$cartItem['truePrice'], (string)$cartItem['cart_num'], 4), 2);
                         }
-                        $newTotalPrice = bcadd($newTotalPrice, bcmul((string)$cartItem['truePrice'], (string)$cartItem['cart_num'], 4), 2);
+                        unset($cartItem);
+                        $payPrice = (float)$newTotalPrice;
+                        $priceGroup['totalPrice'] = $newTotalPrice;
                     }
-                    unset($cartItem);
-                    $payPrice = (float)$newTotalPrice;
-                    $priceGroup['totalPrice'] = $newTotalPrice;
+                } catch (\Exception $e) {
+                    @file_put_contents("quanju.txt", json_encode($e->getMessage())."-报错内容\r\n", 8);
+                    throw $e;
                 }
             }
             //使用优惠劵