//这是查询是否有上级
public static function getPaddress($address){ $res = self::where(['address'=>$address])->find(); if($res && $res['paddress']){ return $res['paddress']; }else{ return ''; } }
$my = $UserName; $arr = []; while (true) { $model_duser = new Duser(); $paddress = $model_duser->getPaddress($my); $plevel = Db::name("duser")->where(['address'=>$paddress])->find(); if (empty($paddress)) { array_push($arr,$paddress.'——等级名称(超级管理员'); break; } if ($plevel['id'] == 1) { array_push($arr,$paddress.'——等级名称(超级管理员)'); break; } $pnode = Db::name("node")->where(['id'=>$plevel['level']])->find(); $my = $paddress; array_push($arr,$my.'——等级名称('.$pnode['name'].')'); }
$this->view->assign('arr', $arr);
duser表有关于节点的字段,每个用户都有一个级别。
原创文章,作者:端木书台,如若转载,请注明出处:https://blog.ytso.com/tech/pnotes/273858.html