mirror of https://gitee.com/karson/fastadmin.git
Pre Merge pull request !169 from 悟空/master
commit
9d291a6e76
|
|
@ -152,6 +152,7 @@ class Crud extends Command
|
|||
$this
|
||||
->setName('crud')
|
||||
->addOption('table', 't', Option::VALUE_REQUIRED, 'table name without prefix', null)
|
||||
->addOption('module', 'a', Option::VALUE_OPTIONAL, 'app module name', null)
|
||||
->addOption('controller', 'c', Option::VALUE_OPTIONAL, 'controller name', null)
|
||||
->addOption('model', 'm', Option::VALUE_OPTIONAL, 'model name', null)
|
||||
->addOption('fields', 'i', Option::VALUE_OPTIONAL, 'model visible fields', null)
|
||||
|
|
@ -186,6 +187,12 @@ class Crud extends Command
|
|||
protected function execute(Input $input, Output $output)
|
||||
{
|
||||
$adminPath = dirname(__DIR__) . DS;
|
||||
//应用模块
|
||||
$moduleName = $input->getOption('module');
|
||||
if (!$moduleName) {
|
||||
$moduleName='admin';
|
||||
}
|
||||
$modulePath = dirname($adminPath) . DS . $moduleName . DS;
|
||||
//数据库
|
||||
$db = $input->getOption('db');
|
||||
//表名
|
||||
|
|
@ -298,7 +305,6 @@ class Crud extends Command
|
|||
$prefix = Config::get($db . '.prefix');
|
||||
|
||||
//模块
|
||||
$moduleName = 'admin';
|
||||
$modelModuleName = $local ? $moduleName : 'common';
|
||||
$validateModuleName = $local ? $moduleName : 'common';
|
||||
|
||||
|
|
@ -393,15 +399,15 @@ class Crud extends Command
|
|||
$lastValue = array_pop($viewArr);
|
||||
$viewArr[] = Loader::parseName($lastValue, 0);
|
||||
array_unshift($viewArr, 'view');
|
||||
$viewDir = $adminPath . strtolower(implode(DS, $viewArr)) . DS;
|
||||
$viewDir = $modulePath . strtolower(implode(DS, $viewArr)) . DS;
|
||||
|
||||
//最终将生成的文件路径
|
||||
$javascriptFile = ROOT_PATH . 'public' . DS . 'assets' . DS . 'js' . DS . 'backend' . DS . $controllerBaseName . '.js';
|
||||
$javascriptFile = ROOT_PATH . 'public' . DS . 'assets' . DS . 'js' . DS . 'backend' . DS . $moduleName .DS . $controllerBaseName . '.js';
|
||||
$addFile = $viewDir . 'add.html';
|
||||
$editFile = $viewDir . 'edit.html';
|
||||
$indexFile = $viewDir . 'index.html';
|
||||
$recyclebinFile = $viewDir . 'recyclebin.html';
|
||||
$langFile = $adminPath . 'lang' . DS . Lang::detect() . DS . $controllerBaseName . '.php';
|
||||
$langFile = $modulePath . 'lang' . DS . Lang::detect() . DS . $controllerBaseName . '.php';
|
||||
|
||||
//是否为删除模式
|
||||
$delete = $input->getOption('delete');
|
||||
|
|
|
|||
Loading…
Reference in New Issue