This commit is contained in:
2021-10-28 11:26:58 +08:00
parent 031b576e24
commit 42d32242b6
2 changed files with 20 additions and 5 deletions
+12 -3
View File
@@ -34,6 +34,7 @@ class GiiCommand extends Command
$this->setName('sw:gii')
->addArgument('action', InputArgument::REQUIRED)
->addArgument('name', InputArgument::OPTIONAL)
->addArgument('databases', InputArgument::OPTIONAL)
->setDescription('./snowflake sw:gii make=model|controller|task|interceptor|limits|middleware name=xxxx');
}
@@ -43,6 +44,7 @@ class GiiCommand extends Command
* @param OutputInterface $output
* @return int
* @throws ConfigException
* @throws Exception
*/
public function execute(InputInterface $input, OutputInterface $output): int
{
@@ -50,9 +52,16 @@ class GiiCommand extends Command
$gii = Kiri::app()->get('gii');
$connections = Kiri::app()->get('db');
// if ($input->getArgument('databases')) {
// return $gii->run($connections->get($input->getArgument('databases')), $input);
// }
if ($input->hasArgument('databases')) {
$gii->run($connections->get($input->getArgument('databases')), $input);
return 1;
}
$action = $input->getArgument('action');
if (!in_array($action, ['model', 'controller'])) {
$gii->run(null, $input);
return 1;
}
$array = [];
foreach (Config::get('databases.connections') as $key => $connection) {
+8 -2
View File
@@ -44,10 +44,13 @@ interface ' . ucfirst($name) . 'RpcInterface
}
private function createProducers($name)
private function createProducers($name): string
{
$html = '<?php
namespace Rpc\Producers;
use Annotation\Target;
use Http\Handler\Controller;
use Kiri\Rpc\Annotation\JsonRpc;
@@ -75,10 +78,13 @@ class ' . ucfirst($name) . 'RpcController extends Controller implements ' . ucfi
}
private function createConsumer($name)
private function createConsumer($name): string
{
$html = '<?php
namespace Rpc\Consumers;
use Annotation\Target;
use Http\Handler\Controller;
use Kiri\Rpc\Annotation\JsonRpc;