注意,这里的模型的参数是这样的,`adminCategoryTableTree($currentIds = 0, $tpl = '')` 也就是说 `$currentIds` 默认为 `0`,`$tpl` 可以根据实际情况进行更改!
## 代码
```
<?php
namespace app\agent\controller;
use app\agent\model\AgentCategoryModel;
use think\Controller;
class AdminCategoryController extends Controller
{
/**
* 分类列表
*/
public function index()
{
$agentCategoryModel = new AgentCategoryModel();
$categoryTree = $agentCategoryModel->adminCategoryTableTree();
$this->assign('category_tree', $categoryTree);
return $this->fetch();
}
}
```