shish hace 3 años
padre
commit
7ae7e2be26
Se han modificado 1 ficheros con 10 adiciones y 1 borrados
  1. 10 1
      biz-ghs/product/services/ProductService.php

+ 10 - 1
biz-ghs/product/services/ProductService.php

@@ -21,19 +21,23 @@ class ProductService extends BaseService
     const TJ_CLASS_ID = '-1';
     //常用花材分类
     const OFTEN_CLASS_ID = '-2';
+    const PRESELL_CLASS_ID = '-3';
 
     //组装分类花材数据
     public static function assembleData($classIds, $itemInfoData, $showTodayDiscount = false)
     {
         //今日特价
         $tjItem = [];
-
+        $preSellItem = [];
         if ($itemInfoData) {
             foreach ($itemInfoData as $v) {
                 $v['classId'] = self::TJ_CLASS_ID;
                 if (isset($v['discountPrice']) && $v['discountPrice'] > 0) {
                     $tjItem[] = $v;
                 }
+                if (isset($v['presell']) && $v['presell'] == 1) {
+                    $preSellItem[] = $v;
+                }
             }
         }
 
@@ -83,6 +87,11 @@ class ProductService extends BaseService
                 'classCover' => imgUtil::groupImg('item_class/tj.jpg'), 'child' => $tjItem,]];
             $classData = array_merge($tjClass, $classData);
         }
+        if ($showTodayDiscount && !empty($preSellItem)) {
+            $preSellClass = [['classId' => self::PRESELL_CLASS_ID, 'className' => '预售专区', 'print' => 0,
+                'classCover' => imgUtil::groupImg('item_class/mrfl.png'), 'child' => $tjItem,]];
+            $classData = array_merge($preSellClass, $classData);
+        }
         return $classData;
     }