Commit c0bd1927 by HanSon

缓存目录增加用户文件夹

1 parent ee5e9f1f
...@@ -9,8 +9,7 @@ ...@@ -9,8 +9,7 @@
namespace Hanson\Vbot\Collections; namespace Hanson\Vbot\Collections;
use Hanson\Vbot\Core\Server; use Hanson\Vbot\Support\FileManager;
use Hanson\Vbot\Support\Console;
class ContactFactory class ContactFactory
{ {
...@@ -59,11 +58,11 @@ class ContactFactory ...@@ -59,11 +58,11 @@ class ContactFactory
$this->getBatchGroupMembers(); $this->getBatchGroupMembers();
if(server()->config['debug']){ if(server()->config['debug']){
file_put_contents(server()->config['tmp'] . 'contact.json', json_encode(contact()->all())); FileManager::download('contact.json', json_encode(contact()->all()));
file_put_contents(server()->config['tmp'] . 'member.json', json_encode(member()->all())); FileManager::download('member.json', json_encode(member()->all()));
file_put_contents(server()->config['tmp'] . 'group.json', json_encode(group()->all())); FileManager::download('group.json', json_encode(group()->all()));
file_put_contents(server()->config['tmp'] . 'official.json', json_encode(Official::getInstance()->all())); FileManager::download('official.json', json_encode(official()->all()));
file_put_contents(server()->config['tmp'] . 'special.json', json_encode(Special::getInstance()->all())); FileManager::download('special.json', json_encode(Special::getInstance()->all()));
} }
} }
......
...@@ -12,9 +12,9 @@ namespace Hanson\Vbot\Support; ...@@ -12,9 +12,9 @@ namespace Hanson\Vbot\Support;
class FileManager class FileManager
{ {
public static function download($name, $data, $path) public static function download($name, $data, $path = '')
{ {
$path = server()->config['tmp'] . $path; $path = server()->config['tmp'] . myself()->nickname . '/' . $path;
if(!is_dir(realpath($path))){ if(!is_dir(realpath($path))){
mkdir($path, 0700, true); mkdir($path, 0700, true);
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!