From 867319ba9e4ea81de53fadada209e0d99073b141 Mon Sep 17 00:00:00 2001 From: zhaoxiang Date: Wed, 26 Jun 2019 16:13:31 +0800 Subject: [PATCH] =?UTF-8?q?modified=20=E4=BC=98=E5=8C=96=E7=AD=9B=E9=80=89?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=EF=BC=8C=E5=90=8C=E6=AD=A5=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/App.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/application/admin/controller/App.php b/application/admin/controller/App.php index 9546d4f..77eeab1 100644 --- a/application/admin/controller/App.php +++ b/application/admin/controller/App.php @@ -30,22 +30,21 @@ class App extends Base { $type = $this->request->get('type', ''); $status = $this->request->get('status', ''); - $where = []; - if ($status === '1' || $status === '0') { - $where['app_status'] = $status; + $obj = new AdminApp(); + if (strlen($status)) { + $obj = $obj->where('app_status', $status); } if ($type) { switch ($type) { case 1: - $where['app_id'] = $keywords; + $obj = $obj->where('app_id', $keywords); break; case 2: - $where['app_name'] = ['like', "%{$keywords}%"]; + $obj = $obj->whereLike('app_name', "%{$keywords}%"); break; } } - $listObj = (new AdminApp())->where($where)->order('app_addTime DESC') - ->paginate($limit, false, ['page' => $start])->toArray(); + $listObj = $obj->order('app_add_time DESC')->paginate($limit, false, ['page' => $start])->toArray(); return $this->buildSuccess([ 'list' => $listObj['data'], @@ -111,7 +110,7 @@ class App extends Base { 'app_name' => $postData['app_name'], 'app_info' => $postData['app_info'], 'app_group' => $postData['app_group'], - 'app_addTime' => time(), + 'app_add_time' => time(), 'app_api' => '', 'app_api_show' => '', ];