shish 2 سال پیش
والد
کامیت
3dc71c407a

+ 1 - 1
app-ghs/controllers/CpController.php

@@ -21,7 +21,7 @@ class CpController extends BaseController
         if (!empty($classId)) {
             $where['classId'] = $classId;
         }
-        $respond = CpClass::getJhList($where);
+        $respond = CpClass::getCpList($where);
         util::success($respond);
     }
 

+ 26 - 0
app-ghs/controllers/PtCpController.php

@@ -0,0 +1,26 @@
+<?php
+
+namespace ghs\controllers;
+
+use bizGhs\cp\classes\PtCpClass;
+use common\components\util;
+use Yii;
+
+class PtCpController extends BaseController
+{
+
+    //根据分类id取集合,带分页 ssh 20231228
+    public function actionList()
+    {
+        $get = Yii::$app->request->get();
+        $classId = $get['classId'] ?? 0;
+        $where = [];
+        $where['delStatus'] = 0;
+        if (!empty($classId)) {
+            $where['classId'] = $classId;
+        }
+        $respond = PtCpClass::getPtCpList($where);
+        util::success($respond);
+    }
+
+}

+ 1 - 1
biz-ghs/cp/classes/CpClass.php

@@ -13,7 +13,7 @@ class CpClass extends BaseClass
 
     public static $baseFile = '\bizGhs\cp\models\Cp';
 
-    public static function getJhList($where)
+    public static function getCpList($where)
     {
         $data = self::getList('*', $where, 'addTime DESC');
         if (!empty($data['list'])) {

+ 17 - 0
biz-ghs/cp/classes/PtCpClass.php

@@ -3,6 +3,7 @@
 namespace bizGhs\cp\classes;
 
 use bizGhs\base\classes\BaseClass;
+use common\components\imgUtil;
 use Yii;
 
 class PtCpClass extends BaseClass
@@ -15,4 +16,20 @@ class PtCpClass extends BaseClass
         return self::add($data, true);
     }
 
+    public static function getPtCpList($where)
+    {
+        $data = self::getList('*', $where, 'addTime DESC');
+        if (!empty($data['list'])) {
+            foreach ($data['list'] as $key => $val) {
+                $shortCover = $val['cover'] ?? '';
+                $cover = imgUtil::groupImg($shortCover) . "?x-oss-process=image/resize,m_fill,h_130,w_130";
+                $bigCover = imgUtil::groupImg($shortCover) . "?x-oss-process=image/resize,m_fill,h_700,w_700";
+                $data['list'][$key]['shortCover'] = $shortCover;
+                $data['list'][$key]['cover'] = $cover;
+                $data['list'][$key]['bigCover'] = $bigCover;
+            }
+        }
+        return $data;
+    }
+
 }