shish 3 lat temu
rodzic
commit
82f00710d0
1 zmienionych plików z 16 dodań i 20 usunięć
  1. 16 20
      biz-ghs/product/services/ProductService.php

+ 16 - 20
biz-ghs/product/services/ProductService.php

@@ -32,24 +32,22 @@ class ProductService extends BaseService
         $preSellItem = [];
         if ($itemInfoData) {
             foreach ($itemInfoData as $v) {
-                $one = $v;
-                $two = $v;
                 if (isset($v['presell']) && $v['presell'] == 1) {
-                    $one['classId'] = self::PRESELL_CLASS_ID;
-                    unset($one['py']);
-                    $preSellItem[] = $one;
-
-                    $two['classId'] = self::PRESELL_CLASS_ID;;
-                    $two['className'] = '预售专区';
+                    $v['classId'] = self::PRESELL_CLASS_ID;;
+                    $v['className'] = '预售专区';
                     $itemGroup[] = $v;
-                } elseif (isset($v['discountPrice']) && $v['discountPrice'] > 0) {
-                    $one['classId'] = self::TJ_CLASS_ID;
-                    unset($one['py']);
-                    $tjItem[] = $one;
 
-                    $two['classId'] = self::TJ_CLASS_ID;;
-                    $two['className'] = '今日特价';
+                    unset($v['className']);
+                    unset($v['py']);
+                    $preSellItem[] = $v;
+                } elseif (isset($v['discountPrice']) && $v['discountPrice'] > 0) {
+                    $v['classId'] = self::TJ_CLASS_ID;;
+                    $v['className'] = '今日特价';
                     $itemGroup[] = $v;
+
+                    unset($v['className']);
+                    unset($v['py']);
+                    $tjItem[] = $v;
                 }
             }
         }
@@ -81,14 +79,12 @@ class ProductService extends BaseService
                             if (in_array($v['itemId'], $items)) {
                                 //冗余给前端使用 2021.1.31 lqh
                                 $v['classId'] = $classId;
-                                $v['print'] = $print;
-
-                                $one = $v;
-                                unset($one['py']);
-                                $tmp['child'][] = $one;
-
                                 $v['className'] = $className;
                                 $itemGroup[] = $v;
+
+                                unset($v['className']);
+                                unset($v['py']);
+                                $tmp['child'][] = $v;
                             }
                         }
                     } else {