mirror of
https://github.com/lkeme/BiliHelper-personal.git
synced 2025-12-19 01:20:08 +08:00
[add] 命令行模式参数启动
This commit is contained in:
parent
5e2b3a20b9
commit
7bfde9acad
11
index.php
11
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()
|
||||
|
||||
@ -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 {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user