This commit is contained in:
JaguarJack
2020-09-04 19:28:30 +08:00
parent ca7a3df823
commit b3be31750a
2 changed files with 8 additions and 7 deletions

View File

@@ -55,7 +55,7 @@ class Generator
// 只有最后成功才写入 route
(new Route())->controller($controller['controller'])
->restful($controller['restful'])
->methods((new Controller())->parseOtherMethods($controller['other_function']))
// ->methods((new Controller())->parseOtherMethods($controller['other_function']))
->done();
} catch (\Exception $exception) {
@@ -76,10 +76,10 @@ class Generator
*/
public function preview($params)
{
$params = \json_decode($params['data'], true);
$type = $params['type'];
$params = \json_decode($params['data'], true);
[$controller, $model] = $this->parseParams($params);
switch ($type) {
@@ -113,7 +113,7 @@ class Generator
'model' => $params['controller']['model'] ?? '',
'controller' => $params['controller']['controller'] ?? '',
'restful' => $params['controller']['restful'],
'other_function' => $params['controller']['other_function'],
// 'other_function' => $params['controller']['other_function'],
];
$table = $params['controller']['table'] ?? '';
@@ -124,8 +124,8 @@ class Generator
$model = [
'table' => $table,
'model' => $params['controller']['model'] ?? '',
'sql' => $params['model']['data'],
'extra' => $params['model']['extra'],
'sql' => $params['table_fields'],
'extra' => $params['table_extra'],
];

View File

@@ -92,13 +92,14 @@ class Controller extends Factory
}
}
/**
if (!empty($params['other_function'])) {
$others = $this->parseOtherMethods($params['other_function']);
$this->methods = array_merge($this->methods, $others);
foreach ($others as $other) {
$content .= $template->otherFunction($other[0], $other[1]);
}
}
}*/
return $content;
}