优化模块下 commands 在cli模式下注入

This commit is contained in:
JaguarJack 2020-07-19 08:46:12 +08:00
parent 929f9b2a75
commit 6e1fdb2b74

View File

@ -52,7 +52,7 @@ abstract class ModuleService extends Service
*/ */
protected function registerCommands() protected function registerCommands()
{ {
if (method_exists($this,'loadCommands')) { if (method_exists($this,'loadCommands') && $this->app->runningInConsole()) {
list($namespace, $path) = $this->loadCommands(); list($namespace, $path) = $this->loadCommands();
$catchConsole = $this->app['catch_console']; $catchConsole = $this->app['catch_console'];