|
@@ -369,15 +369,16 @@ class Model
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
- public function tree($where, $config, $func = false, $set = [])
|
|
|
+ public function tree($where, $config, $func = false, $set = [], $index = 0)
|
|
|
{
|
|
|
$where[$config[0]] = $config[1];
|
|
|
$data = $this->select($where, $set);
|
|
|
if ($data) {
|
|
|
foreach ($data as $k => &$v) {
|
|
|
if ($func) $v = call_user_func($func, $k, $v);
|
|
|
+ //if ($index > 0) $v['name'] = ' -- ' . $v['name'];
|
|
|
$config[1] = $v[$config[2]];
|
|
|
- $child = $this->tree($where, $config, $func, $set);
|
|
|
+ $child = $this->tree($where, $config, $func, $set, 1);
|
|
|
if ($child) {
|
|
|
$v['children'] = $child;
|
|
|
}
|