shish пре 2 година
родитељ
комит
0f9656a9e7
2 измењених фајлова са 24 додато и 9 уклоњено
  1. 9 1
      app-ghs/controllers/ItemClassController.php
  2. 15 8
      app-ghs/controllers/ItemController.php

+ 9 - 1
app-ghs/controllers/ItemClassController.php

@@ -31,7 +31,7 @@ class ItemClassController extends BaseController
                         'cover' => imgUtil::groupImg('item_class/mrfl.png') . "?x-oss-process=image/resize,m_fill,h_130,w_130"
                     ];
                 }
-                if ((isset($item->discountPrice) && $item->discountPrice > 0) || ($reachNum > 0 && $reachNumDiscount > 0)) {
+                if (isset($item->discountPrice) && $item->discountPrice > 0) {
                     $arr['tj'] = [
                         'id' => -1,
                         'name' => '今日特价',
@@ -39,6 +39,14 @@ class ItemClassController extends BaseController
                         'cover' => imgUtil::groupImg('item_class/tj.jpg') . "?x-oss-process=image/resize,m_fill,h_130,w_130"
                     ];
                 }
+                if ($reachNum > 0 && $reachNumDiscount > 0) {
+                    $arr['mj'] = [
+                        'id' => -2,
+                        'name' => '今日满减',
+                        'shortCover' => 'item_class/mrfl.jpg',
+                        'cover' => imgUtil::groupImg('item_class/mrfl.jpg') . "?x-oss-process=image/resize,m_fill,h_130,w_130"
+                    ];
+                }
             }
         }
         $classInfo = ItemClassClass::getGhsItemClassAll($mainId);

+ 15 - 8
app-ghs/controllers/ItemController.php

@@ -29,8 +29,22 @@ class ItemController extends BaseController
         $classId = Yii::$app->request->get('classId', 0);
         $where['mainId'] = $this->mainId;
         $where['delStatus'] = $delStatus;
+        if (!empty($status)) {
+            $where['status'] = $status;
+        }
+        if ($requestType == 'book') {
+            unset($where['status']);
+        }
         if (!empty($classId)) {
-            $where['classId'] = $classId;
+            if ($classId == -1) {
+                $where['discountPrice'] = 1;
+            } elseif ($classId == -2) {
+                $where['reachNum>'] = 0;
+            } elseif ($classId == -3) {
+                $where['presell'] = 1;
+            } else {
+                $where['classId'] = $classId;
+            }
         }
         if ($py) {
             $pyName = strtolower($py);
@@ -40,13 +54,6 @@ class ItemController extends BaseController
         if ($requestType == 'changePrice' || $requestType == 'hasStockList') {
             $where['stock>'] = 0;
         }
-        if (!empty($status)) {
-            $where['status'] = $status;
-        }
-        if ($requestType == 'book') {
-            unset($where['status']);
-        }
-        //客户等级
         $customId = Yii::$app->request->get('customId', 0);
         $level = 1;
         if (!empty($customId)) {