From 908039c13d366438d87ef1478a62ef75c426781f Mon Sep 17 00:00:00 2001 From: simon429 <1095568674@qq.com> Date: Tue, 29 Sep 2020 15:46:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=B0=83=E7=94=A8PID?= =?UTF-8?q?=E4=B8=BA0=E6=97=B6=E6=97=A0=E6=B3=95=E8=B0=83=E7=94=A8?= =?UTF-8?q?=E9=A1=B6=E7=BA=A7=E5=88=86=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/admin/controller/Ajax.php | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/application/admin/controller/Ajax.php b/application/admin/controller/Ajax.php index 8ea11e044..8fa3adc6e 100644 --- a/application/admin/controller/Ajax.php +++ b/application/admin/controller/Ajax.php @@ -220,17 +220,16 @@ class Ajax extends Backend $type = $this->request->get('type'); $pid = $this->request->get('pid'); $where = ['status' => 'normal']; - $categorylist = null; - if ($pid !== '') { - if ($type) { - $where['type'] = $type; - } - if ($pid) { - $where['pid'] = $pid; - } - - $categorylist = Db::name('category')->where($where)->field('id as value,name')->order('weigh desc,id desc')->select(); + $categorylist = null; + if ($pid || $pid === '0') { + $where['pid'] = $pid; + } + if ($type) { + $where['type'] = $type; } + + $categorylist = Db::name('category')->where($where)->field('id as value,name')->order('weigh desc,id desc')->select(); + $this->success('', null, $categorylist); } -- Gitee