mirror of
https://gitee.com/apiadmin/ApiAdmin.git
synced 2025-04-25 10:56:34 +08:00
modified 优化筛选功能,同步数据库字段
This commit is contained in:
parent
b0aec7548f
commit
867319ba9e
@ -30,22 +30,21 @@ class App 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 AdminApp();
|
||||||
if ($status === '1' || $status === '0') {
|
if (strlen($status)) {
|
||||||
$where['app_status'] = $status;
|
$obj = $obj->where('app_status', $status);
|
||||||
}
|
}
|
||||||
if ($type) {
|
if ($type) {
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 1:
|
case 1:
|
||||||
$where['app_id'] = $keywords;
|
$obj = $obj->where('app_id', $keywords);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
$where['app_name'] = ['like', "%{$keywords}%"];
|
$obj = $obj->whereLike('app_name', "%{$keywords}%");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$listObj = (new AdminApp())->where($where)->order('app_addTime DESC')
|
$listObj = $obj->order('app_add_time DESC')->paginate($limit, false, ['page' => $start])->toArray();
|
||||||
->paginate($limit, false, ['page' => $start])->toArray();
|
|
||||||
|
|
||||||
return $this->buildSuccess([
|
return $this->buildSuccess([
|
||||||
'list' => $listObj['data'],
|
'list' => $listObj['data'],
|
||||||
@ -111,7 +110,7 @@ class App extends Base {
|
|||||||
'app_name' => $postData['app_name'],
|
'app_name' => $postData['app_name'],
|
||||||
'app_info' => $postData['app_info'],
|
'app_info' => $postData['app_info'],
|
||||||
'app_group' => $postData['app_group'],
|
'app_group' => $postData['app_group'],
|
||||||
'app_addTime' => time(),
|
'app_add_time' => time(),
|
||||||
'app_api' => '',
|
'app_api' => '',
|
||||||
'app_api_show' => '',
|
'app_api_show' => '',
|
||||||
];
|
];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user