diff --git a/index.php b/index.php index dd2a4b3..c7b3e5a 100644 --- a/index.php +++ b/index.php @@ -11,6 +11,17 @@ require 'vendor/autoload.php'; + +if ($argc >= 3) { + if ($argv[2] == 'script') { + define('__MODE__', 2); + } +} +if (!defined('__MODE__')) { + define('__MODE__', 1); +} + + $app = new BiliHelper\Core\App(__DIR__); $app->load($argv) ->inspect() diff --git a/src/core/App.php b/src/core/App.php index 092173a..3c689ec 100644 --- a/src/core/App.php +++ b/src/core/App.php @@ -62,7 +62,7 @@ class App */ public function newTask(string $taskName, string $dir) { - asyncCall(function () use ($taskName, $dir) { + asyncCall(function() use ($taskName, $dir) { while (true) { try { call_user_func(array("BiliHelper\\$dir\\" . $taskName, 'run'), []); @@ -148,7 +148,7 @@ class App public function start() { // Todo 模式名称需要优化 - if ($this->script_mode) { + if (__MODE__ == 2) { Log::info('执行Script模式'); $this->script_m(); } else { diff --git a/src/plugin/Notice.php b/src/plugin/Notice.php index b6392a1..489778a 100644 --- a/src/plugin/Notice.php +++ b/src/plugin/Notice.php @@ -192,7 +192,7 @@ class Notice 'msgtype' => 'markdown', 'markdown' => [ 'title' => $info['title'], - 'content' => $info['content'], + 'text' => $info['content'], ] ]; $headers = [