mirror of
https://gitee.com/apiadmin/ApiAdmin.git
synced 2025-05-23 21:39:36 +08:00
modified 优化筛选功能
This commit is contained in:
parent
71265083c9
commit
b0aec7548f
@ -27,21 +27,21 @@ class AppGroup extends Base {
|
|||||||
$type = $this->request->get('type', '');
|
$type = $this->request->get('type', '');
|
||||||
$status = $this->request->get('status', '');
|
$status = $this->request->get('status', '');
|
||||||
|
|
||||||
$where = [];
|
$obj = new AdminAppGroup();
|
||||||
if ($status === '1' || $status === '0') {
|
if (strlen($status)) {
|
||||||
$where['status'] = $status;
|
$obj = $obj->where('status', $status);
|
||||||
}
|
}
|
||||||
if ($type) {
|
if ($type) {
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 1:
|
case 1:
|
||||||
$where['hash'] = $keywords;
|
$obj = $obj->where('hash', $keywords);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
$where['name'] = ['like', "%{$keywords}%"];
|
$obj = $obj->whereLike('name', "%{$keywords}%");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$listObj = (new AdminAppGroup())->where($where)->paginate($limit, false, ['page' => $start])->toArray();
|
$listObj = $obj->paginate($limit, false, ['page' => $start])->toArray();
|
||||||
|
|
||||||
return $this->buildSuccess([
|
return $this->buildSuccess([
|
||||||
'list' => $listObj['data'],
|
'list' => $listObj['data'],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user