コード例 #1
0
 public function updateAction()
 {
     $name = $this->request->getPost('name');
     $enums = $this->request->getPost('enums');
     if (!$name) {
         parent::error(1, array('msg' => 'None name error'));
         return;
     }
     $classNamePath = self::getEnumPath();
     $jsonName = "{$classNamePath}/const/{$name}.json";
     file_put_contents($jsonName, json_encode($enums));
     $cmdLine = "--json={$jsonName}";
     $results = Python3::run('build_enum.py', $cmdLine);
     parent::result(array('file' => $jsonName, 'results' => $results));
 }
コード例 #2
0
 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));
 }
コード例 #3
0
 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()));
 }