Browse Source

improve share dir save

master
filesite 6 months ago
parent
commit
3bc141471d
  1. 12
      plugins/Common.php

12
plugins/Common.php

@ -51,7 +51,11 @@ Class Common {
//保存用户多收藏夹目录映射关系 //保存用户多收藏夹目录映射关系
public static function saveUserDirMap($cellphone, $username, $new_dir) { public static function saveUserDirMap($cellphone, $username, $new_dir) {
$my_user_map = self::getMyDirs($cellphone, $username); $my_user_map = self::getMyDirs($cellphone, $username);
array_push($my_user_map, $new_dir); if (!in_array($new_dir, $my_user_map)) {
array_push($my_user_map, $new_dir);
}else {
return true;
}
$my_id = self::getUserId($cellphone); $my_id = self::getUserId($cellphone);
$rootDir = __DIR__ . '/../www/' . FSC::$app['config']['content_directory']; $rootDir = __DIR__ . '/../www/' . FSC::$app['config']['content_directory'];
@ -89,7 +93,7 @@ Class Common {
} }
} }
return $map; return array_unique($map, SORT_NUMERIC);
} }
//保存用户共享目录记录 //保存用户共享目录记录
@ -124,7 +128,7 @@ Class Common {
if(!empty($shareDirs[$friends_cellphone]) && in_array($share_dir, $shareDirs[$friends_cellphone])) { if(!empty($shareDirs[$friends_cellphone]) && in_array($share_dir, $shareDirs[$friends_cellphone])) {
$shareDirs[$friends_cellphone] = array_diff($shareDirs[$friends_cellphone], array($share_dir)); $shareDirs[$friends_cellphone] = array_diff($shareDirs[$friends_cellphone], array($share_dir));
}else { }else {
return false; return true;
} }
$my_id = self::getUserId($cellphone); $my_id = self::getUserId($cellphone);
@ -325,7 +329,7 @@ Class Common {
array_merge($map, $tajian_user_map[$cellphone]) : array_push($map, $tajian_user_map[$cellphone]); array_merge($map, $tajian_user_map[$cellphone]) : array_push($map, $tajian_user_map[$cellphone]);
} }
return array_unique($map); return array_unique($map, SORT_NUMERIC);
} }
public static function getNicknameByDir($dir, $username){ public static function getNicknameByDir($dir, $username){

Loading…
Cancel
Save