Commit c0bd1927 by HanSon

缓存目录增加用户文件夹

1 parent ee5e9f1f
......@@ -9,8 +9,7 @@
namespace Hanson\Vbot\Collections;
use Hanson\Vbot\Core\Server;
use Hanson\Vbot\Support\Console;
use Hanson\Vbot\Support\FileManager;
class ContactFactory
{
......@@ -59,11 +58,11 @@ class ContactFactory
$this->getBatchGroupMembers();
if(server()->config['debug']){
file_put_contents(server()->config['tmp'] . 'contact.json', json_encode(contact()->all()));
file_put_contents(server()->config['tmp'] . 'member.json', json_encode(member()->all()));
file_put_contents(server()->config['tmp'] . 'group.json', json_encode(group()->all()));
file_put_contents(server()->config['tmp'] . 'official.json', json_encode(Official::getInstance()->all()));
file_put_contents(server()->config['tmp'] . 'special.json', json_encode(Special::getInstance()->all()));
FileManager::download('contact.json', json_encode(contact()->all()));
FileManager::download('member.json', json_encode(member()->all()));
FileManager::download('group.json', json_encode(group()->all()));
FileManager::download('official.json', json_encode(official()->all()));
FileManager::download('special.json', json_encode(Special::getInstance()->all()));
}
}
......
......@@ -12,9 +12,9 @@ namespace Hanson\Vbot\Support;
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))){
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!