shish hace 2 años
padre
commit
b663ee7177
Se han modificado 2 ficheros con 6 adiciones y 2 borrados
  1. 2 1
      app-ghs/controllers/ItemController.php
  2. 4 1
      biz-ghs/item/classes/ItemClass.php

+ 2 - 1
app-ghs/controllers/ItemController.php

@@ -201,6 +201,7 @@ class ItemController extends BaseController
     {
         $get = Yii::$app->request->get();
         $name = $get['name'] ?? '';
+        $num = $get['num'] ?? 0;
         $where = ['mainId' => $this->mainId, 'delStatus' => 0];
         if (!empty($name)) {
             if (stringUtil::isLetter($name)) {
@@ -209,7 +210,7 @@ class ItemController extends BaseController
                 $where['name'] = ['like', $name];
             }
         }
-        $respond = ItemClass::getSimpleList($where);
+        $respond = ItemClass::getSimpleList($where, $num);
         util::success($respond);
     }
 

+ 4 - 1
biz-ghs/item/classes/ItemClass.php

@@ -15,12 +15,15 @@ class ItemClass extends BaseClass
 
     public static $baseFile = '\bizGhs\item\models\Item';
 
-    public static function getSimpleList($where)
+    public static function getSimpleList($where, $num)
     {
         $data = self::getList('id,name,price,stock,frontHide,cover', $where);
         if (isset($data['list']) && !empty($data['list'])) {
             foreach ($data['list'] as $key => $val) {
                 $data['list'][$key]['bigCount'] = '';
+                if ($num > 0) {
+                    $data['list'][$key]['bigCount'] = $num;
+                }
                 $data['list'][$key]['smallCount'] = '';
                 $shortCover = $val['cover'] ?? '';
                 $smallCover = imgUtil::groupImg($shortCover) . "?x-oss-process=image/resize,m_fill,h_130,w_130";