/**
  * 清理用户缓存
  * @param $permissionId
  */
 public static function clearUserPermission($permissionId)
 {
     $roles = [];
     foreach (RolePermission::find()->where(['permission_id' => $permissionId])->all() as $rolePerm) {
         $roles[] = $rolePerm['role_id'];
     }
     foreach (AdminUserRole::find()->where(['role_id' => $roles])->all() as $userRole) {
         AdminUser::clearPermission($userRole['user_id']);
     }
 }
 /**
  * 获取用户的权限列表
  * @param $userId
  */
 public static function getPermission($userId)
 {
     $_cache_key = self::CACHE_MY_PERMISSION . $userId;
     $myPermission = self::getCache()->get($_cache_key);
     if ($myPermission) {
         return $myPermission;
     }
     $roles = [];
     foreach (AdminUserRole::find()->where(['user_id' => $userId])->all() as $role) {
         $roles[] = $role->role_id;
     }
     $permissions = [];
     foreach (RolePermission::find()->where(['role_id' => $roles])->all() as $permission) {
         $permissions[] = $permission['permission_id'];
     }
     self::getCache()->set($_cache_key, $permissions);
     return $permissions;
 }