初始化
This commit is contained in:
42
app/command/test.php
Normal file
42
app/command/test.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\command;
|
||||
|
||||
use think\console\Command;
|
||||
use think\console\Input;
|
||||
use think\console\input\Argument;
|
||||
use think\console\input\Option;
|
||||
use think\console\Output;
|
||||
|
||||
use Curl\Curl;
|
||||
|
||||
use Aria2;
|
||||
|
||||
class test extends Command
|
||||
{
|
||||
protected function configure()
|
||||
{
|
||||
// 指令配置
|
||||
$this->setName('test')
|
||||
->setDescription('the test command');
|
||||
}
|
||||
|
||||
protected function execute(Input $input, Output $output)
|
||||
{
|
||||
|
||||
$aria2 = new Aria2('http://127.0.0.1:16800/jsonrpc');
|
||||
try {
|
||||
// 获取所有活动的下载任务
|
||||
$activeDownloads = $aria2->getGlobalStat();
|
||||
|
||||
dump('正在下载的任务数量:',intval($activeDownloads['result']['numWaiting']));
|
||||
// dump('等待下载的任务数量:',$waitingCount);
|
||||
|
||||
} catch (Exception $e) {
|
||||
dump($e);
|
||||
}
|
||||
// 指令输出
|
||||
// $output->writeln('test');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user