新增在线查询支持站点表格显示

This commit is contained in:
iyuu.cn
2020-01-21 02:18:23 +08:00
parent 7c35291b15
commit 36d07a25db
4 changed files with 339 additions and 44 deletions

View File

@ -10,6 +10,7 @@ use IYUU\Client\qBittorrent\qBittorrent;
use IYUU\Client\Transmission\TransmissionRPC;
use IYUU\Library\IFile;
use IYUU\Library\Oauth;
use IYUU\Library\Table;
/**
* IYUUAutoReseed自动辅种类
@ -89,6 +90,7 @@ class AutoReseed
*/
public static function init()
{
self::ShowTableSites();
global $configALL;
self::$clients = isset($configALL['default']['clients']) && $configALL['default']['clients'] ? $configALL['default']['clients'] : array();
echo "程序正在初始化运行参数... \n";
@ -103,6 +105,43 @@ class AutoReseed
Oauth::login(self::$apiUrl . self::$endpoints['login']);
}
/**
* 显示支持站点列表
*/
private static function ShowTableSites(){
$list[] = 'gitee 源码仓库https://gitee.com/ledc/IYUUAutoReseed';
$list[] = 'github源码仓库https://github.com/ledccn/IYUUAutoReseed';
$list[] = '教程https://gitee.com/ledc/IYUUAutoReseed/tree/master/wiki';
$list[] = "QQ群859882209 【IYUU自动辅种交流】 \n";
foreach ($list as $key => $value) {
echo $value.PHP_EOL;
}
// 发起请求
echo "正在连接IYUUAutoReseed服务器查询支持列表…… \n";
$curl = new Curl();
$curl->setOpt(CURLOPT_SSL_VERIFYPEER, false); // 禁止验证证书
$curl->setOpt(CURLOPT_SSL_VERIFYHOST, false); // 不检查证书
$res = $curl->post(self::$apiUrl);
$sites = json_decode($res->response, true);
$data = [];
$i = $j = $k = 0;
foreach($sites as $v)
{
// 控制多少列
if ($i > 4) {
$k++;
$i = 0;
}
$i++;
$j++;
$data[$k][] = $j.". ".$v['site'];
}
echo "IYUUAutoReseed自动辅种脚本目前支持以下站点".PHP_EOL;
//输出表格
$table = new Table();
$table->setRows($data);
echo($table->render());
}
/**
* 连接远端RPC服务器
*