diff --git a/app/admin/common.php b/app/admin/common.php
index b8d6614..89f1f7a 100644
--- a/app/admin/common.php
+++ b/app/admin/common.php
@@ -130,4 +130,23 @@ if (!function_exists('get_dir'))
}
return $dirArray;
}
-}
\ No newline at end of file
+}
+
+if (!function_exists('get_tree_list'))
+{
+ /*无限分类*/
+ function get_tree_list(&$list,$pid=0,$level=0,$html='|—')
+ {
+ static $tree = array();
+ foreach ($list as $v) {
+ if ($v['pid'] == $pid) {
+ $v['sort'] = $level;
+ $v['html'] = str_repeat($html, $level);
+ $tree[] = $v;
+ get_tree_list($list, $v['id'], $level + 1);
+ }
+ }
+ return $tree;
+ }
+
+}
diff --git a/app/admin/controller/Article.php b/app/admin/controller/Article.php
index 0db71b5..06cf1b1 100644
--- a/app/admin/controller/Article.php
+++ b/app/admin/controller/Article.php
@@ -109,7 +109,13 @@ class Article extends AuthController
*/
public function add()
{
- $this->assign("category",cModel::selectByType(2));
+ $where = [
+ 'name' => '',
+ 'status' => ''
+ ];
+ $category = cModel::systemPage($where);
+ $category = get_tree_list($category);
+ $this->assign("category",$category);
return $this->fetch();
}
@@ -122,7 +128,13 @@ class Article extends AuthController
*/
public function edit(Request $request)
{
- $this->assign("category",CModel::selectByType(2));
+ $where = [
+ 'name' => '',
+ 'status' => ''
+ ];
+ $category = cModel::systemPage($where);
+ $category = get_tree_list($category);
+ $this->assign("category",$category);
$this->assign("info",aModel::get($request->param(['id'])));
return $this->fetch();
diff --git a/app/admin/view/article/add.html b/app/admin/view/article/add.html
index 7136ddc..83ef08f 100644
--- a/app/admin/view/article/add.html
+++ b/app/admin/view/article/add.html
@@ -38,7 +38,7 @@
diff --git a/app/admin/view/article/edit.html b/app/admin/view/article/edit.html
index 73c039b..fe4b4dd 100644
--- a/app/admin/view/article/edit.html
+++ b/app/admin/view/article/edit.html
@@ -38,7 +38,7 @@