tp5无限极分类,限制横向传递(同一体系相互传递)

1.use fastTree;  

2. 

// 判断同线账号(利用当前账号的id查询上下级集合)

$alluser = Userinfo::all();  //查询所有用户数据
$tree = Tree::instance();
$tree->init($alluser);
$myteam = $tree->getChildren($miner_id);  // 得出下线的id集
$myteampid = $tree->getParent($miner_id);// 得出上线的id集
// 合并数组
$arr = array_merge($myteam,$myteampid);
foreach($arr as $key => $row){
$aaa[] = $row['id'];
}
// 判断受赠者的id是否存在该数组中
if (!in_array($touser['id'], $aaa)){
return $this->error('非同线账号');
}

原文地址:https://www.cnblogs.com/roseY/p/9438533.html