~~~php
//本级别的id
$this->getSup($member['id']);
~~~
```
//获取所有下级
public function getSup($id,$n = 0)
{
global $_W;
global $_GPC;
$res = pdo_get('ewei_shop_member', array('agentid' => $id));
if ($res['id']!=0) {
if($n){
$ids .= "," . $res['id'];
}else{
$ids =$res['id'];
}
$n++;
$ids .= $this->getSup($res['id'],$n);
}
return $ids;
}
```