新增临时生成模式;

This commit is contained in:
2022-08-08 14:46:59 +08:00
parent 310b632183
commit 2add792d01
2 changed files with 19 additions and 0 deletions

View File

@@ -244,6 +244,13 @@ class BuildCurdService
return $this->tableColumns;
}
public function setRootDir($dir)
{
$this->rootDir = $dir;
return $this;
}
/**
* 设置主表

View File

@@ -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 = [];