This commit is contained in:
molong
2022-10-04 15:10:37 +08:00
parent d2752116a7
commit 96319f0898
23 changed files with 338 additions and 39 deletions

View File

@@ -7,6 +7,7 @@
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
use think\facade\Cache;
use sent\tree\Tree;
function getDepartmentChild($pid = 0){
$department = Cache::get('department');
@@ -28,8 +29,8 @@ function getChilds($data, $id = 0, $pk = 'id', $pid = 'parent_id') {
$array = [];
foreach ($data as $k => $v) {
if ($v[$pid] == $id) {
$array[] = (int) $v[$pk];
array_merge($array, getChilds($data, $v[$pk]));
$array[] = $v[$pk];
$array = array_merge($array, getChilds($data, $v[$pk]));
}
}
return $array;