|
|
@@ -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);
|