From 2583c4e5dc7262904641c08562bf90030308e3eb Mon Sep 17 00:00:00 2001 From: filesite Date: Wed, 5 Jun 2024 23:17:52 +0800 Subject: [PATCH] improve dir data get --- plugins/Common.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/plugins/Common.php b/plugins/Common.php index 6fe3c11..5714635 100644 --- a/plugins/Common.php +++ b/plugins/Common.php @@ -222,7 +222,6 @@ Class Common { $dirs_after_delete = $friends_dirs; if (in_array($share_dir, $friends_dirs)) { $dirs_after_delete = array_diff($friends_dirs, array($share_dir)); - $dirs_after_delete = array_values($dirs_after_delete); }else { return true; } @@ -333,6 +332,16 @@ Class Common { return $username; } + public static function dictToArray($dict) { + $arr = array(); + + foreach($dict as $key => $value) { + array_push($arr, $value); + } + + return $arr; + } + //从自己的目录里获取收藏夹映射关系 //返回:数组 public static function getMyDirs($cellphone, $username){ @@ -351,7 +360,9 @@ Class Common { if (file_exists($cache_filename)) { $mapContent = file_get_contents($cache_filename); $map = json_decode($mapContent); - $map = array_values($map); + if (is_object($map)) { + $map = self::dictToArray($map); + } } }