shish пре 2 година
родитељ
комит
ad8f6cc7fa
1 измењених фајлова са 11 додато и 2 уклоњено
  1. 11 2
      app-ghs/controllers/CpController.php

+ 11 - 2
app-ghs/controllers/CpController.php

@@ -15,12 +15,21 @@ class CpController extends BaseController
     {
         $get = Yii::$app->request->get();
         $classId = $get['classId'] ?? 0;
+        $search = $get['search'] ?? '';
         $mainId = $this->mainId ?? 0;
         $where = [];
         $where['mainId'] = $mainId;
         $where['delStatus'] = 0;
-        if (!empty($classId)) {
-            $where['classId'] = $classId;
+        if (!empty($search)) {
+            if (stringUtil::isLetter($search)) {
+                $where['py'] = ['like', $search];
+            } else {
+                $where['name'] = ['like', $search];
+            }
+        } else {
+            if (!empty($classId)) {
+                $where['classId'] = $classId;
+            }
         }
         $respond = CpClass::getCpList($where);
         util::success($respond);