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') $this->setName('sw:gii')
->addArgument('action', InputArgument::REQUIRED) ->addArgument('action', InputArgument::REQUIRED)
->addArgument('name', InputArgument::OPTIONAL) ->addArgument('name', InputArgument::OPTIONAL)
->addArgument('databases', InputArgument::OPTIONAL)
->setDescription('./snowflake sw:gii make=model|controller|task|interceptor|limits|middleware name=xxxx'); ->setDescription('./snowflake sw:gii make=model|controller|task|interceptor|limits|middleware name=xxxx');
} }
@@ -43,6 +44,7 @@ class GiiCommand extends Command
* @param OutputInterface $output * @param OutputInterface $output
* @return int * @return int
* @throws ConfigException * @throws ConfigException
* @throws Exception
*/ */
public function execute(InputInterface $input, OutputInterface $output): int public function execute(InputInterface $input, OutputInterface $output): int
{ {
@@ -50,9 +52,16 @@ class GiiCommand extends Command
$gii = Kiri::app()->get('gii'); $gii = Kiri::app()->get('gii');
$connections = Kiri::app()->get('db'); $connections = Kiri::app()->get('db');
// if ($input->getArgument('databases')) { if ($input->hasArgument('databases')) {
// return $gii->run($connections->get($input->getArgument('databases')), $input); $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 = []; $array = [];
foreach (Config::get('databases.connections') as $key => $connection) { 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 $html = '<?php
namespace Rpc\Producers;
use Annotation\Target; use Annotation\Target;
use Http\Handler\Controller; use Http\Handler\Controller;
use Kiri\Rpc\Annotation\JsonRpc; 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 $html = '<?php
namespace Rpc\Consumers;
use Annotation\Target; use Annotation\Target;
use Http\Handler\Controller; use Http\Handler\Controller;
use Kiri\Rpc\Annotation\JsonRpc; use Kiri\Rpc\Annotation\JsonRpc;