Esempio n. 1
0
 public function getMyFunc()
 {
     $user_id = $this->getId();
     $myFunc = array();
     //获取角色权限
     $func_ids = [];
     $myRoles = User_Role_Relate::getByUid($user_id);
     if (!empty($myRoles)) {
         foreach ($myRoles as $role) {
             $rolePurviews = Role_Purview::getByRoleId($role['role_id']);
             foreach ($rolePurviews as $rolePurview) {
                 $func_ids[] = $rolePurview['func_id'];
             }
         }
     }
     //获取用户权限
     $userPurviews = User_Purview::getByUid($user_id);
     if (!empty($userPurviews)) {
         foreach ($userPurviews as $purview) {
             $func_ids[] = $purview['func_id'];
         }
     }
     $condition = ['id' => $func_ids];
     $myFunc = Func::search($condition, 0, 0, array('id' => SORT_ASC), false, 'id');
     return $myFunc['list'];
 }