From 514bb6b5204b832197252b2d1fe7f3049a7d4288 Mon Sep 17 00:00:00 2001 From: JaguarJack Date: Wed, 29 Apr 2020 15:05:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=AF=BC=E5=85=A5=E6=A0=91?= =?UTF-8?q?=E7=8A=B6=E6=95=B0=E6=8D=AE=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- catch/system/database/seeds/GenerateSeed.php | 1 + extend/catcher/Utils.php | 37 +++++++++++++++++++ .../command/{ => Tools}/BackupCommand.php | 1 - .../{ => Tools}/CompressPackageCommand.php | 0 .../command/Tools/ExportDataCommand.php | 32 ++++++++++++++++ 5 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 catch/system/database/seeds/GenerateSeed.php rename extend/catcher/command/{ => Tools}/BackupCommand.php (99%) rename extend/catcher/command/{ => Tools}/CompressPackageCommand.php (100%) create mode 100644 extend/catcher/command/Tools/ExportDataCommand.php diff --git a/catch/system/database/seeds/GenerateSeed.php b/catch/system/database/seeds/GenerateSeed.php new file mode 100644 index 0000000..b3d9bbc --- /dev/null +++ b/catch/system/database/seeds/GenerateSeed.php @@ -0,0 +1 @@ +insertGetId($value); + + if ($children) { + foreach ($children as &$v) { + $v[$pid] = $id; + $v['level'] = !$value[$pid] ? $id : $value['level'] . '-' .$id; + } + self::importTreeData($children, $table, $primaryKey); + } + } + } } diff --git a/extend/catcher/command/BackupCommand.php b/extend/catcher/command/Tools/BackupCommand.php similarity index 99% rename from extend/catcher/command/BackupCommand.php rename to extend/catcher/command/Tools/BackupCommand.php index 2beeabf..4cc66cf 100644 --- a/extend/catcher/command/BackupCommand.php +++ b/extend/catcher/command/Tools/BackupCommand.php @@ -4,7 +4,6 @@ declare (strict_types = 1); namespace catcher\command; use catcher\CatchAdmin; -use think\Config; use think\console\Command; use think\console\Input; use think\console\input\Argument; diff --git a/extend/catcher/command/CompressPackageCommand.php b/extend/catcher/command/Tools/CompressPackageCommand.php similarity index 100% rename from extend/catcher/command/CompressPackageCommand.php rename to extend/catcher/command/Tools/CompressPackageCommand.php diff --git a/extend/catcher/command/Tools/ExportDataCommand.php b/extend/catcher/command/Tools/ExportDataCommand.php new file mode 100644 index 0000000..e027cf9 --- /dev/null +++ b/extend/catcher/command/Tools/ExportDataCommand.php @@ -0,0 +1,32 @@ +setName('backup:data') + ->addArgument('tables', Argument::REQUIRED, 'backup tables') + ->addOption('zip', '-z',Option::VALUE_NONE, 'is need zip') + ->setDescription('backup data you need'); + } + + protected function execute(Input $input, Output $output) + { + + $output->info('succeed!'); + } +}