Files
pull-courseware/app/command/test.php
2025-04-18 00:39:21 +08:00

43 lines
990 B
PHP

<?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');
}
}