From c826d83b40c8f1e1f725667cc9e562a721d41628 Mon Sep 17 00:00:00 2001 From: molong Date: Thu, 22 Jun 2017 10:47:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=A8=A1=E7=89=88=E4=B8=8B?= =?UTF-8?q?=E7=9A=84.gitignore=E6=96=87=E4=BB=B6=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=85=AC=E5=85=B1=E5=87=BD=E6=95=B0=E5=86=85=E7=9A=84=E4=B8=80?= =?UTF-8?q?=E4=B8=AAbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/common.php | 15 ++++++--------- template/.gitignore | 0 2 files changed, 6 insertions(+), 9 deletions(-) delete mode 100644 template/.gitignore diff --git a/application/common.php b/application/common.php index c2bcf1b6..9a7ad5b8 100644 --- a/application/common.php +++ b/application/common.php @@ -981,24 +981,21 @@ function get_category_list_tree($model) { /* 读取缓存数据 */ if (empty($list)) { - $list = D('category')->select(); + $list = db('Category')->select(); cache('sys_category_list', $list); } - foreach ($list as $key => $value) { - if ($model) { + if ($model) { + foreach ($list as $key => $value) { $models = explode(',', $value['model']); if (in_array($model, $models)) { $res[] = $value; } - } else { - $res[] = $value; } + } else { + $res = $list; } - $res = list_unique($res); + $tree = list_to_tree($res); - if ($limit) { - $tree = array_slice($tree, 0, $limit); - } return $tree; } diff --git a/template/.gitignore b/template/.gitignore deleted file mode 100644 index e69de29b..00000000