检查代码缩进规范

This commit is contained in:
iyuu.cn
2020-01-18 10:26:51 +08:00
parent 84b3f23c27
commit 51f3fa39bc
3 changed files with 241 additions and 242 deletions

View File

@ -367,7 +367,7 @@ class AutoReseed
$res = $curl->post(self::$apiUrl . self::$endpoints['reseed'], $hashArray);
$resArray = json_decode($res->response, true);
// 写返回日志
if(true){
if (true) {
// 文件句柄
$resource = fopen(self::$cacheDir.'reseed.txt', "wb");
// 成功返回写入字节数失败返回false
@ -375,9 +375,9 @@ class AutoReseed
fclose($resource);
}
// 判断返回值
if ( isset($resArray['errmsg']) && ($resArray['errmsg'] == 'ok') ) {
if (isset($resArray['errmsg']) && ($resArray['errmsg'] == 'ok')) {
echo "辅种信息提交成功!!! \n\n";
}else{
} else {
$errmsg = isset($resArray['errmsg']) ? $resArray['errmsg'] : '远端服务器无响应,请稍后重试!';
echo '-----辅种失败,原因:' .$errmsg. " \n\n";
exit(1);
@ -416,31 +416,31 @@ class AutoReseed
* 前置检测
*/
// passkey检测
if ( empty($configALL[$sites[$sitesID]['site']]['passkey']) ) {
if (empty($configALL[$sites[$sitesID]['site']]['passkey'])) {
echo '-------因当前' .$sites[$sitesID]['site']. "站点未设置passkey已跳过 \n\n";
self::$wechatMsg['reseedSkip']++;
continue;
}
// cookie检测
if ( in_array($sites[$sitesID]['site'], self::$cookieCheck) && empty($configALL[$sites[$sitesID]['site']]['cookie']) ) {
if (in_array($sites[$sitesID]['site'], self::$cookieCheck) && empty($configALL[$sites[$sitesID]['site']]['cookie'])) {
echo '-------因当前' .$sites[$sitesID]['site']. '站点未设置cookie已跳过' . "\n\n";
self::$wechatMsg['reseedSkip']++;
continue;
}
// 流控检测
if ( isset($configALL[$sites[$sitesID]['site']]['limit']) ) {
if (isset($configALL[$sites[$sitesID]['site']]['limit'])) {
echo "-------因当前" .$sites[$sitesID]['site']. "站点触发流控,已跳过!! {$_url} \n\n";
self::$wechatMsg['reseedSkip']++;
continue;
}
// 重复做种检测
if ( isset($infohash_Dir[$value['info_hash']]) ) {
if (isset($infohash_Dir[$value['info_hash']])) {
echo '-------与客户端现有种子重复:'.$_url."\n\n";
self::$wechatMsg['reseedRepeat']++;
continue;
}
// 历史添加检测
if ( is_file(self::$cacheHash . $value['info_hash'].'.txt') ) {
if (is_file(self::$cacheHash . $value['info_hash'].'.txt')) {
echo '-------当前种子上次辅种已成功添加,已跳过! '.$_url."\n\n";
self::$wechatMsg['reseedPass']++;
continue;
@ -469,7 +469,7 @@ class AutoReseed
*/
// 判断是否具有VIP或特殊权限
$is_vip = isset($configALL[$sites[$sitesID]['site']]['is_vip']) && $configALL[$sites[$sitesID]['site']]['is_vip'] ? 1 : 0;
if ( (in_array($sites[$sitesID]['site'], self::$noReseed)==false) || $is_vip ) {
if ((in_array($sites[$sitesID]['site'], self::$noReseed)==false) || $is_vip) {
/**
* 可以辅种
*/
@ -488,11 +488,11 @@ class AutoReseed
$offset = strpos($details_html, $download_page);
$urlTemp = substr($details_html, $offset, 50);
// 种子地址
$_url = substr($urlTemp,0,strpos($urlTemp,'">'));
$_url = substr($urlTemp, 0, strpos($urlTemp, '">'));
$_url = 'https://' .$sites[$sitesID]['base_url']. '/' . $_url;
print "种子下载页:".$_url. "\n";
$url = download($_url, $cookie, $userAgent);
if(strpos($url,'系统检测到过多的种子下载请求') != false){
if (strpos($url, '系统检测到过多的种子下载请求') != false) {
echo "当前站点触发人机验证,已加入排除列表 \n";
ff($sites[$sitesID]['site']. '站点,辅种时触发人机验证!');
$configALL[$sites[$sitesID]['site']]['limit'] = 1;
@ -503,17 +503,17 @@ class AutoReseed
$cookie = isset($configALL[$sites[$sitesID]['site']]['cookie']) ? $configALL[$sites[$sitesID]['site']]['cookie'] : '';
$userAgent = $configALL['default']['userAgent'];
print "种子:".$_url. "\n";
if ( isset($configALL[$sites[$sitesID]['site']]['cuhash']) ) {
if (isset($configALL[$sites[$sitesID]['site']]['cuhash'])) {
// 已获取cuhash
# code...
}else {
} else {
// 获取cuhash
$html = download('https://' .$sites[$sitesID]['base_url']. '/pt', $cookie, $userAgent);
// 提取种子下载地址
$offset = strpos($html,'cuhash=');
$offset = strpos($html, 'cuhash=');
$len = strlen('cuhash=');
$cuhashTemp = substr($html,$offset+$len,40);
$configALL[$sites[$sitesID]['site']]['cuhash'] = substr($cuhashTemp,0,strpos($cuhashTemp,'"'));
$cuhashTemp = substr($html, $offset+$len, 40);
$configALL[$sites[$sitesID]['site']]['cuhash'] = substr($cuhashTemp, 0, strpos($cuhashTemp, '"'));
}
$url = $_url."&cuhash=". $configALL[$sites[$sitesID]['site']]['cuhash'];
// 城市下载种子时会302转向
@ -547,7 +547,7 @@ class AutoReseed
fclose($resource);
self::$wechatMsg['reseedSuccess']++;
continue;
}else{
} else {
// 失败的种子
// 不同站点的错误提示
switch ($sites[$sitesID]['site']) {
@ -560,13 +560,13 @@ class AutoReseed
self::$wechatMsg['reseedError']++;
continue;
}
}else{
} else {
/**
* 不辅种
*/
echo '-------已跳过不辅种的站点:'.$_url."\n\n";
// 写入日志文件,供用户手动辅种
if ( !isset($infohash_Dir[$value['info_hash']]) ) {
if (!isset($infohash_Dir[$value['info_hash']])) {
// 站点类型判断
switch ($sites[$sitesID]['site']) {
case 'hdchina':

View File

@ -17,5 +17,4 @@ interface AbstractClientInterface
* @return string
*/
public function status();
}