From 2add792d01324f541db7823ed96360c7f86c37fa Mon Sep 17 00:00:00 2001 From: augushong Date: Mon, 8 Aug 2022 14:46:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=B8=B4=E6=97=B6=E7=94=9F?= =?UTF-8?q?=E6=88=90=E6=A8=A1=E5=BC=8F=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/service/curd/BuildCurdService.php | 7 +++++++ app/common/command/Curd.php | 12 ++++++++++++ 2 files changed, 19 insertions(+) diff --git a/app/admin/service/curd/BuildCurdService.php b/app/admin/service/curd/BuildCurdService.php index 6be68cb..3d84f68 100644 --- a/app/admin/service/curd/BuildCurdService.php +++ b/app/admin/service/curd/BuildCurdService.php @@ -244,6 +244,13 @@ class BuildCurdService return $this->tableColumns; } + public function setRootDir($dir) + { + $this->rootDir = $dir; + + return $this; + } + /** * 设置主表 diff --git a/app/common/command/Curd.php b/app/common/command/Curd.php index 62706f9..a130f13 100644 --- a/app/common/command/Curd.php +++ b/app/common/command/Curd.php @@ -5,11 +5,13 @@ namespace app\common\command; use app\admin\service\curd\BuildCurdService; +use app\common\tools\PathTools; use think\console\Command; use think\console\Input; use think\console\input\Option; use think\console\Output; use think\Exception; +use think\facade\App; class Curd extends Command { @@ -22,6 +24,7 @@ class Curd extends Command # ->addOption('force', 'f', Option::VALUE_NONE, '强制覆盖模式') ->addOption('delete', 'd', Option::VALUE_NONE, '删除模式') + ->addOption('runtime', 'r', Option::VALUE_NONE, '临时生成') ->setDescription('一键curd命令服务'); } @@ -53,6 +56,15 @@ class Curd extends Command ->setTable($table) ->setForce($force); + if ($input->hasOption('runtime')) { + + $runtime_path = App::getRuntimePath() . 'source/build/' . date('YmdHis') . '/'; + dump($runtime_path); + PathTools::intiDir($runtime_path . 'a.temp'); + + $build->setRootDir($runtime_path); + } + $columns = $build->getTableColumns(); $relations = [];