WIN-2308041133\Administrator 7 mesiacov pred
rodič
commit
9d5c574952
1 zmenil súbory, kde vykonal 6 pridanie a 33 odobranie
  1. 6 33
      app/models/store/StoreProduct.php

+ 6 - 33
app/models/store/StoreProduct.php

@@ -286,12 +286,14 @@ class StoreProduct extends BaseModel
      * */
     public static function setLevelPrice($list, $uid, $isSingle = false)
     {
+        @file_put_contents('quanju.txt', json_encode($list) . "-计算vip价格\r\n", 8);
         if (is_object($list)) $list = count($list) ? $list->toArray() : [];
         if (!sys_config('vip_open')) {
             if (is_array($list)) return $list;
             return $isSingle ? $list : 0;
         }
         $levelId = UserLevel::getUserLevel($uid);
+
         if ($levelId) {
             $discount = UserLevel::getUserLevelInfo($levelId, 'discount');
             $discount = bcsub(1, bcdiv($discount, 100, 2), 2);
@@ -299,7 +301,7 @@ class StoreProduct extends BaseModel
             $discount = SystemUserLevel::getLevelDiscount();
             $discount = bcsub(1, bcdiv($discount, 100, 2), 2);
         }
-        @file_put_contents('quanju.txt', $discount . "-折扣\r\n", 8);
+//        @file_put_contents('quanju.txt', $discount . "-折扣\r\n", 8);
         //如果不是数组直接执行减去会员优惠金额
         if (!is_array($list))
             //不是会员原价返回
@@ -308,50 +310,21 @@ class StoreProduct extends BaseModel
                 return $isSingle ? bcsub($list, bcmul($discount, $list, 2), 2) : bcmul($discount, $list, 2);
             else
                 return $isSingle ? $list : 0;
+
         //当$list为数组时$isSingle==true为一维数组 ,否则为二维
-//        @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 ($list['is_inclusive'] == 1 || $list['is_points'] == 1 || $list['is_explosive'] == 1) {
                 $discount=0;
            }
             $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 {
             foreach ($list as &$item) {
                 if ($list['is_inclusive'] == 1 || $list['is_points'] == 1 || $list['is_explosive'] == 1) {
                     $discount=0;
                 }
                     $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);
+//                @file_put_contents('quanju.txt', $item['vip_price'] . "-数组vip价格\r\n", 8);
             }
         }