shish 2 роки тому
батько
коміт
5166f34106
1 змінених файлів з 8 додано та 0 видалено
  1. 8 0
      app-ghs/controllers/CpItemController.php

+ 8 - 0
app-ghs/controllers/CpItemController.php

@@ -17,12 +17,20 @@ class CpItemController extends BaseController
     {
         $get = Yii::$app->request->get();
         $cpId = $get['cpId'] ?? 0;
+        $search = $get['search'] ?? '';
         $mainId = $this->mainId ?? 0;
         $where = [];
         $where['mainId'] = $mainId;
         if (!empty($cpId)) {
             $where['cpId'] = $cpId;
         }
+        if (!empty($search)) {
+            if (stringUtil::isLetter($search)) {
+                $where['py'] = $search;
+            } else {
+                $where['name'] = $search;
+            }
+        }
         $respond = CpItemClass::getItemList($where);
         util::success($respond);
     }