|
|
@ -24,6 +24,30 @@ Class Common { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//初始化用户数据目录 |
|
|
|
|
|
|
|
public static function initUserData($cellphone, $friends_code = '') { |
|
|
|
|
|
|
|
$rootDir = __DIR__ . '/../www/' . FSC::$app['config']['content_directory']; |
|
|
|
|
|
|
|
$userDir = "{$rootDir}{$cellphone}"; |
|
|
|
|
|
|
|
if (is_dir($userDir)) { |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
mkdir("{$userDir}/data/", 0700, true); //分享视频目录 |
|
|
|
|
|
|
|
mkdir("{$userDir}/tags/", 0700, true); //分类目录 |
|
|
|
|
|
|
|
copy("{$rootDir}README.md", "{$userDir}/README.md"); |
|
|
|
|
|
|
|
copy("{$rootDir}README_title.txt", "{$userDir}/README_title.txt"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!empty($friends_code)) { |
|
|
|
|
|
|
|
file_put_contents("{$userDir}/README_friendscode.txt", $friends_code); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}catch(Exception $e) { |
|
|
|
|
|
|
|
throw new Exception("创建用户数据目录失败:" . $e->getMessage()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//检查朋友的邀请码是否存在 |
|
|
|
//检查朋友的邀请码是否存在 |
|
|
|
public static function existFriendsCode($code) { |
|
|
|
public static function existFriendsCode($code) { |
|
|
|
if (self::isFriendsCode($code) == false) {return false;} |
|
|
|
if (self::isFriendsCode($code) == false) {return false;} |
|
|
|