WIN-2308041133\Administrator 4 months ago
parent
commit
ccd47b946d
1 changed files with 40 additions and 23 deletions
  1. 40 23
      app/models/store/StoreProduct.php

+ 40 - 23
app/models/store/StoreProduct.php

@@ -299,6 +299,7 @@ class StoreProduct extends BaseModel
             $discount = SystemUserLevel::getLevelDiscount();
             $discount = SystemUserLevel::getLevelDiscount();
             $discount = bcsub(1, bcdiv($discount, 100, 2), 2);
             $discount = bcsub(1, bcdiv($discount, 100, 2), 2);
         }
         }
+        @file_put_contents('quanju.txt', $discount . "-折扣\r\n", 8);
         //如果不是数组直接执行减去会员优惠金额
         //如果不是数组直接执行减去会员优惠金额
         if (!is_array($list))
         if (!is_array($list))
             //不是会员原价返回
             //不是会员原价返回
@@ -308,33 +309,49 @@ class StoreProduct extends BaseModel
             else
             else
                 return $isSingle ? $list : 0;
                 return $isSingle ? $list : 0;
         //当$list为数组时$isSingle==true为一维数组 ,否则为二维
         //当$list为数组时$isSingle==true为一维数组 ,否则为二维
-        @file_put_contents('quanju.txt', json_encode($isSingle) . "-是不是数组\r\n", 8);
+//        @file_put_contents('quanju.txt', json_encode($isSingle) . "-是不是数组\r\n", 8);
+//        if ($isSingle) {
+//
+////            if (!empty($list['is_inclusive']) && !empty($list['is_points']) && !empty($list['is_explosive'])) {
+//                if ($list['is_inclusive'] == 0 && $list['is_points'] == 0 && $list['is_explosive'] == 0) {
+//                    $list['vip_price'] = isset($list['price']) ? bcsub($list['price'], bcmul($discount, $list['price'], 2), 2) : 0;
+//                }else{
+//                    $list['vip_price'] = 0;
+//                }
+//            @file_put_contents('quanju.txt', $list['vip_price'] . "-vip价格\r\n", 8);
+////            } else {
+////                $list['vip_price'] = isset($list['price']) ? bcsub($list['price'], bcmul(100, $list['price'], 2), 2) : 0;
+////            }
+//
+//        } else {
+//
+//            foreach ($list as &$item) {
+////                if (!empty($list['is_inclusive']) && !empty($list['is_points']) && !empty($list['is_explosive'])) {
+//                    if ($item['is_inclusive'] == 0 && $item['is_points'] == 0 && $item['is_explosive'] == 0) {
+////                @file_put_contents('quanju.txt',  json_encode($item)."-5\r\n", 8);
+//                        $item['vip_price'] = isset($item['price']) ? bcsub($item['price'], bcmul($discount, $item['price'], 2), 2) : 0;
+//                    }else{
+//                        $item['vip_price'] = 0;
+//                    }
+//                @file_put_contents('quanju.txt', $list['vip_price'] . "-数组vip价格\r\n", 8);
+////                } else {
+////                    $item['vip_price'] = isset($item['price']) ? bcsub($item['price'], bcmul(100, $item['price'], 2), 2) : 0;
+////                }
+//            }
+//        }
         if ($isSingle) {
         if ($isSingle) {
-
-//            if (!empty($list['is_inclusive']) && !empty($list['is_points']) && !empty($list['is_explosive'])) {
-                if ($list['is_inclusive'] == 0 && $list['is_points'] == 0 && $list['is_explosive'] == 0) {
-                    $list['vip_price'] = isset($list['price']) ? bcsub($list['price'], bcmul($discount, $list['price'], 2), 2) : 0;
-                }else{
-                    $list['vip_price'] = 0;
-                }
+            if ($list['is_inclusive'] == 1 || $list['is_points'] == 1 || $list['is_explosive'] == 1) {
+                $discount=1;
+           }
+            $list['vip_price'] = isset($list['price']) ? bcsub($list['price'], bcmul($discount, $list['price'], 2), 2) : 0;
             @file_put_contents('quanju.txt', $list['vip_price'] . "-vip价格\r\n", 8);
             @file_put_contents('quanju.txt', $list['vip_price'] . "-vip价格\r\n", 8);
-//            } else {
-//                $list['vip_price'] = isset($list['price']) ? bcsub($list['price'], bcmul(100, $list['price'], 2), 2) : 0;
-//            }
-
         } else {
         } else {
-
             foreach ($list as &$item) {
             foreach ($list as &$item) {
-//                if (!empty($list['is_inclusive']) && !empty($list['is_points']) && !empty($list['is_explosive'])) {
-                    if ($item['is_inclusive'] == 0 && $item['is_points'] == 0 && $item['is_explosive'] == 0) {
-//                @file_put_contents('quanju.txt',  json_encode($item)."-5\r\n", 8);
-                        $item['vip_price'] = isset($item['price']) ? bcsub($item['price'], bcmul($discount, $item['price'], 2), 2) : 0;
-                    }else{
-                        $item['vip_price'] = 0;
-                    }
-//                } else {
-//                    $item['vip_price'] = isset($item['price']) ? bcsub($item['price'], bcmul(100, $item['price'], 2), 2) : 0;
-//                }
+                if ($list['is_inclusive'] == 1 || $list['is_points'] == 1 || $list['is_explosive'] == 1) {
+                    $discount=1;
+                }
+                    $item['vip_price'] = isset($item['price']) ? bcsub($item['price'], bcmul($discount, $item['price'], 2), 2) : 0;
+                @file_put_contents('quanju.txt', $item['vip_price'] . "-数组vip价格\r\n", 8);
             }
             }
         }
         }