shish 3 ani în urmă
părinte
comite
f6005a1673

+ 7 - 1
app-pt/controllers/ItemCatRelateController.php

@@ -15,7 +15,13 @@ class ItemCatRelateController extends BaseController
 
     public function actionList()
     {
-
+        $catId = Yii::$app->request->get('catId', 0);
+        $where = [];
+        if (is_numeric($catId)) {
+            $where['catId'] = $catId;
+        }
+        $list = PtItemCatRelateClass::getItemList($where);
+        util::success($list);
     }
 
 }

+ 12 - 0
biz/item/classes/PtItemCatRelateClass.php

@@ -9,4 +9,16 @@ class PtItemCatRelateClass extends BaseClass
 
     public static $baseFile = '\biz\item\models\PtItemCatRelate';
 
+    public static function getItemList($where)
+    {
+        $data = self::getList('*', $where, 'inTurn DESC');
+        $list = $data['list'];
+        if (!empty($list)) {
+            $ids = array_column($list, 'itemId');
+            $list = PtItemClass::getAllByCondition(['id' => ['in', $ids]], null, '*');
+            $data['list'] = $list;
+        }
+        return $data;
+    }
+
 }