数据库备份

This commit is contained in:
JaguarJack
2020-07-19 16:47:58 +08:00
parent 027ba1acdb
commit 78bb8bccd7
4 changed files with 191 additions and 154 deletions

View File

@@ -5,6 +5,7 @@ use catcher\base\CatchRequest as Request;
use catcher\base\CatchController;
use catcher\CatchResponse;
use catcher\exceptions\FailedException;
use catcher\library\BackUpDatabase;
use think\facade\Console;
use think\facade\Db;
use think\Paginator;
@@ -87,10 +88,10 @@ class DataDictionary extends CatchController
* @throws FailedException
* @return \think\response\Json
*/
public function backup(): \think\response\Json
public function backup(BackUpDatabase $backUpDatabase): \think\response\Json
{
try {
Console::call('backup:data', [trim(implode(',', \request()->post('data')), ','), '-z']);
$backUpDatabase->done(trim(implode(',', \request()->post('data')), ','));
}catch (\Exception $e) {
throw new FailedException($e->getMessage());
}