Kirin 2 سال پیش
والد
کامیت
aa6d7f9e0e
1فایلهای تغییر یافته به همراه18 افزوده شده و 17 حذف شده
  1. 18 17
      app/admin/controller/store/Placeorder.php

+ 18 - 17
app/admin/controller/store/Placeorder.php

@@ -118,25 +118,26 @@ class Placeorder extends AuthController
                 $info = [];
             }
         }
-        var_dump($info);
-        $product = \app\admin\model\store\StoreProduct::get($info['product_id']);
-        $discounts = json_decode($product['time_area_discount'], true);
-        $discount = 0;
-        if (count($discounts) > 0) {
-            foreach ($discounts as $kk => $v) {
-                $times = explode('-', $kk);
-                if (!(count($times) == 2)) {
-                    break;
-                }
-                $start = strtotime(date('Y-m-d') . $times[0]);
-                $end = strtotime(date('Y-m-d') . $times[1]);
-                if (time() > $start && time() <= $end) {
-                    $discount = $v;
+        if ($info) {
+            $product = \app\admin\model\store\StoreProduct::get($info['product_id']);
+            $discounts = json_decode($product['time_area_discount'], true);
+            $discount = 0;
+            if (count($discounts) > 0) {
+                foreach ($discounts as $kk => $v) {
+                    $times = explode('-', $kk);
+                    if (!(count($times) == 2)) {
+                        break;
+                    }
+                    $start = strtotime(date('Y-m-d') . $times[0]);
+                    $end = strtotime(date('Y-m-d') . $times[1]);
+                    if (time() > $start && time() <= $end) {
+                        $discount = $v;
+                    }
                 }
             }
-        }
-        if ($discount > 0) {
-            $info['price'] = bcmul(bcdiv($discount, 100, 4), $info['price'], 2);
+            if ($discount > 0) {
+                $info['price'] = bcmul(bcdiv($discount, 100, 4), $info['price'], 2);
+            }
         }
         return app('json')->successful($info);
     }