public function previewAction() { $p = $this->request->getPost(); $prefix = $p['prefix']; $tableName = $p['table_name']; if ($prefix) { $tableName = "{$prefix}_{$tableName}"; } $modelName = Strings::tableNameToModelName($tableName); $path = ApplicationConfig::getConfig('product')['path'] . '\\www'; $this->createModelConfigFile($path, $modelName, $p); $configPath = ApplicationConfig::getConfigPath('config.json'); $cmdLine = "--prefix={$prefix} --table={$tableName} --config=\"{$configPath}\""; $c = Python3::run("build_mvc.py", $cmdLine); $targetHost = ApplicationConfig::getConfig('product')['host']; $testListUrl = "{$targetHost}/{$modelName}"; parent::result(array('model' => $modelName, 'files' => json_decode($c), 'cmd_line' => $cmdLine, 'test_list_url' => $testListUrl, 'build' => $c)); }
public function buildAction() { $overwrite = $this->request->getPost('overwrite'); $controller = $this->request->getPost('controller'); $filenamePattern = $this->request->getPost('filename_pattern'); $subdirPattern = $this->request->getPost('subdir_pattern'); //return parent::error(-1, $overwrite); if (!$controller) { return parent::error(-1, false); } $controllerFileName = ''; if (file_exists($controllerFileName) && $overwrite == 'false') { return parent::error(-2, "{$controllerFileName} can NOT be overwrite"); } $configPath = ApplicationConfig::getConfigPath('config.json'); $cmdLine = "--name={$controller} --filename-pattern={$filenamePattern} --subdir-pattern={$subdirPattern} --config=\"{$configPath}\""; $c = Python3::run("build_upload_controller.py", $cmdLine); $this->addFileUploaderModel($controller, $filenamePattern, $subdirPattern); return parent::result(array('post' => $this->request->getPost())); }