dongasai 1 vuosi sitten
vanhempi
commit
73d607137c
2 muutettua tiedostoa jossa 35 lisäystä ja 0 poistoa
  1. 22 0
      src/think/console/Command.php
  2. 13 0
      src/think/console/CommandInterface.php

+ 22 - 0
src/think/console/Command.php

@@ -0,0 +1,22 @@
+<?php
+
+namespace DysUtil\think\console;
+
+use think\console\Input;
+use think\console\Output;
+use think\Log;
+
+abstract class Command extends \think\console\Command implements CommandInterface
+{
+    protected function execute(Input $input, Output $output)
+    {
+        try {
+            $this->handle($input, $output);
+
+        } catch (\Exception $exception) {
+            Log::error($exception->getTraceAsString());
+            return $output->error($exception->getMessage());
+        }
+    }
+
+}

+ 13 - 0
src/think/console/CommandInterface.php

@@ -0,0 +1,13 @@
+<?php
+
+namespace DysUtil\think\console;
+
+
+use think\console\Input;
+use think\console\Output;
+
+interface CommandInterface
+{
+
+    public function handle(Input $input, Output $output);
+}