>數據表設計
|序號|字段名|必選|備注|
|:-|-|-|-|
|1|id|*|primary key|
|2|name|*|項目名|
|3|level|*|級別|
|4|type||級別類型|
|5|status||當前級別狀態|
|6|pid|*|當前級別夫類|
>示例參數數據

>示例源碼
```php
<?php
namespace app\\index\\model;
use think\Model;
class Rule extends Model{
public function getPlevel($pid){
$data = [
'id' =>$pid
];
return $this->where($data)->column('level');
}
public function getPid($id){
$data = [
'id' =>$id
];
return $this->where($data)->column('pid');
}
public function getdatas($id){
$data = [
'id' => $id
];
return $this->where($data)->select();
}
public function tree(){
$rule = [
'status' => 1,
'type' =>1
];
$data=$this->where($rule)->select();
return $this->sort($data);
}
public function sort($data,$pid=0){
static $arr=array();
foreach ($data as $k => $v) {
if($v['pid']==$pid){
$arr[]=$v;
$this->sort($data,$v['id']);
}
}
return $arr;
}
}
```