星星服务器列表

This commit is contained in:
“wanyongkang”
2021-02-23 14:20:04 +08:00
parent c984020112
commit b76fd6b0c5

View File

@@ -17,7 +17,6 @@ $product_list = $product_model->field('Id,Token')->fetchAll();
// die;
$all = fopen(__DIR__ . '/data/all.csv', 'w'); $all = fopen(__DIR__ . '/data/all.csv', 'w');
$dnx_exit = fopen(__DIR__ . '/data/dns_diff.csv', 'a'); $dnx_exit = fopen(__DIR__ . '/data/dns_diff.csv', 'a');
@@ -35,9 +34,14 @@ fclose($qiangzi_f);
$xingxing_data = get_product(__DIR__ . '/data/xingxing.csv'); $xingxing_data = get_product(__DIR__ . '/data/xingxing.csv');
$xingxing_f = fopen(__DIR__ . '/data/xingxing.csv', 'w'); $xingxing_f = fopen(__DIR__ . '/data/xingxing.csv', 'w');
$xingxing = json_decode(file_get_contents("http://47.110.154.124:6930/api/nasStatus.html?format=json"), true); $time = time();
$noce = 'qiangzijuiphualiankeji';
$apikey = 'd50f2b2ffd421efa67df8efb96d5ff6c';
$sign = md5($time.$noce.$apikey);
$url = "http://106.54.198.154/api/getNodeList?agentid=admin1&ti=".$time."&nonce=".$noce."&sign=".$sign;
$xingxing = json_decode(file_get_contents($url), true);
//写入星星文件 //写入星星文件
xingxing_getList($xingxing, $xingxing_f, $all, $xingxing_data); xingxing_getList($xingxing, $xingxing_f, $all, $xingxing_data)['data'];
fclose($xingxing_f); fclose($xingxing_f);
$jike_data = get_product(__DIR__ . '/data/jike.csv'); $jike_data = get_product(__DIR__ . '/data/jike.csv');
@@ -221,12 +225,12 @@ function xingxing_getList($data, &$file, &$all, $exit)
$record = []; $record = [];
$record['name'] = '星星'; $record['name'] = '星星';
$province_detail = mb_substr($info['description'], 0, 2); $province_detail = mb_substr($info['name'], 0, 2);
if (in_array($province_detail, $province)) { if (in_array($province_detail, $province)) {
$province_detail = mb_substr($info['description'], 0, 3); $province_detail = mb_substr($info['name'], 0, 3);
$info['description'] = mb_substr($info['description'], 3); $info['name'] = mb_substr($info['name'], 3);
} elseif (!in_array($province_detail, $citys)) { } elseif (!in_array($province_detail, $citys)) {
$info['description'] = mb_substr($info['description'], 2); $info['name'] = mb_substr($info['name'], 2);
} }
if (!in_array($province_detail, $province_record)) { if (!in_array($province_detail, $province_record)) {
$record['city'] = $province_detail; $record['city'] = $province_detail;
@@ -234,36 +238,28 @@ function xingxing_getList($data, &$file, &$all, $exit)
$key = $province_detail; $key = $province_detail;
$list1[$key][] = $record; $list1[$key][] = $record;
} }
$city_ex = explode('电信', $info['description']); $city_ex = explode('电信', $info['name']);
if (strpos($info['description'], '电信') !== false) { if (strpos($info['name'], '电信') !== false) {
$record['city'] = $city_ex[0] . ($city_ex[1] ?? ''); $record['city'] = $city_ex[0] . ($city_ex[1] ?? '');
$record['supply'] = '电信'; $record['supply'] = '电信';
} elseif (strpos($info['description'], '联通') !== false) { } elseif (strpos($info['name'], '联通') !== false) {
$record['city'] = $city_ex[0] . ($city_ex[1] ?? ''); $record['city'] = $city_ex[0] . ($city_ex[1] ?? '');
$record['supply'] = '联通'; $record['supply'] = '联通';
} elseif (strpos($info['description'], '移动') !== false) { } elseif (strpos($info['name'], '移动') !== false) {
$record['city'] = $city_ex[0] . ($city_ex[1] ?? ''); $record['city'] = $city_ex[0] . ($city_ex[1] ?? '');
$record['supply'] = '移动'; $record['supply'] = '移动';
} else { } else {
$record['city'] = $info['description']; $record['city'] = $info['name'];
$record['supply'] = '电信/联通'; $record['supply'] = '电信/联通';
} }
$record['ip'] = strpos($info['description2'], '-') ? explode('-', $info['description2'])[1] : $info['description2']; $record['ip'] = strpos($info['name2'], '-') ? explode('-', $info['name2'])[1] : $info['name2'];
$record['daikuan'] = $info['bandwidth']; $record['daikuan'] = strpos($info['name2'], '-')[1];
$record['onlineuser'] = ''; $record['onlineuser'] = '';
$record['maxuser'] = ''; $record['maxuser'] = '';
$record['online'] = ($info['online'] == 0) ? '故障' : '正常'; $record['online'] = ($info['status'] == 1) ? '正常' : '故障';
$status_flag = $info['onlineuser'] / $info['maxuser'];
$record['status'] = ''; $record['status'] = '';
if ($status_flag < 0.9) { $record['nasname'] = $info['host'];
$record['status'] = '正常';
} elseif ($status_flag < 1) {
$record['status'] = '拥挤';
} else {
$record['status'] = '满载';
}
$record['nasname'] = $info['nasname'];
if (!in_array($record['nasname'], $exit) && !in_array($record['nasname'], $dnx_has_exit)) { if (!in_array($record['nasname'], $exit) && !in_array($record['nasname'], $dnx_has_exit)) {
fputcsv($dnx_exit, ['星星', $record['nasname'], date('Y-m-d H:i:s')]); fputcsv($dnx_exit, ['星星', $record['nasname'], date('Y-m-d H:i:s')]);
} }
@@ -441,57 +437,57 @@ function mogu_getList($data, &$file, &$all, $exit, $product_name)
function shihui_getList($html, &$file, &$all, $exit) function shihui_getList($html, &$file, &$all, $exit)
{ {
global $dnx_exit, $dnx_has_exit; // global $dnx_exit, $dnx_has_exit;
$key = ''; // $key = '';
$list1 = []; // $list1 = [];
preg_match("/<p>(.*\s*?)<p>&nbsp;<\/p><\/div>/is", $html, $result); // preg_match("/<p>(.*\s*?)<p>&nbsp;<\/p><\/div>/is", $html, $result);
preg_match_all("/<p>(.*?)<\/p>/is", $result[0], $result); // preg_match_all("/<p>(.*?)<\/p>/is", $result[0], $result);
foreach ($result[0] as $k => $info) { // foreach ($result[0] as $k => $info) {
$record = []; // $record = [];
$record['name'] = '实惠'; // $record['name'] = '实惠';
if ($k == 0 || $k == 5) { // if ($k == 0 || $k == 5) {
continue; // continue;
} else { // } else {
$list = explode('<br />', $info); // $list = explode('<br />', $info);
$i = 0; // $i = 0;
foreach ($list as $v) { // foreach ($list as $v) {
$v = trim($v); // $v = trim($v);
$v = trim(str_replace('&nbsp;', '', $v), '</p>'); // $v = trim(str_replace('&nbsp;', '', $v), '</p>');
if ($i == 0 && !empty($v)) { // if ($i == 0 && !empty($v)) {
$record['city'] = $v; // $record['city'] = $v;
$key = $record['city']; // $key = $record['city'];
$list1[$key][] = $record; // $list1[$key][] = $record;
} else { // } else {
if (!empty($v)) { // if (!empty($v)) {
$data = explode(' ', $v); // $data = explode(' ', $v);
$add_data = explode('市', $data[0]); // $add_data = explode('市', $data[0]);
$record['city'] = mb_substr($add_data[0], 2); // $record['city'] = mb_substr($add_data[0], 2);
$record['supply'] = $add_data[1]; // $record['supply'] = $add_data[1];
$record['ip'] = ''; // $record['ip'] = '';
$record['daikuan'] = ''; // $record['daikuan'] = '';
$record['onlineuser'] = ''; // $record['onlineuser'] = '';
$record['maxuser'] = ''; // $record['maxuser'] = '';
$record['online'] = ''; // $record['online'] = '';
$record['status'] = ''; // $record['status'] = '';
$record['nasname'] = $data[count($data) - 1]; // $record['nasname'] = $data[count($data) - 1];
if (!in_array($record['nasname'], $exit) && !in_array($record['nasname'], $dnx_has_exit)) { // if (!in_array($record['nasname'], $exit) && !in_array($record['nasname'], $dnx_has_exit)) {
fputcsv($dnx_exit, ['实惠', $record['nasname'], date('Y-m-d H:i:s')]); // fputcsv($dnx_exit, ['实惠', $record['nasname'], date('Y-m-d H:i:s')]);
} // }
$list1[$key][] = $record; // $list1[$key][] = $record;
} // }
} // }
$i++; // $i++;
} // }
} // }
} // }
foreach ($list1 as $val) { // foreach ($list1 as $val) {
foreach ($val as $net_data) { // foreach ($val as $net_data) {
fputcsv($file, $net_data); // fputcsv($file, $net_data);
fputcsv($all, $net_data); // fputcsv($all, $net_data);
} // }
} // }
} }
//共享 //共享
@@ -739,85 +735,85 @@ function xunlian_getList($data, &$file, &$all, $exit)
function wuxian_getList($html, &$file, &$all, $exit) function wuxian_getList($html, &$file, &$all, $exit)
{ {
global $dnx_exit, $dnx_has_exit; // global $dnx_exit, $dnx_has_exit;
//省会 // //省会
$province = ['黑龙', '内蒙']; // $province = ['黑龙', '内蒙'];
$province_record = []; // $province_record = [];
$key = ''; // $key = '';
$list1 = []; // $list1 = [];
$citys = ['北京', '上海', '天津', '重庆']; // $citys = ['北京', '上海', '天津', '重庆'];
preg_match("/<div>&nbsp;<\/div>(.*?)<\/div><\/div>/is", $html, $result); // preg_match("/<div>&nbsp;<\/div>(.*?)<\/div><\/div>/is", $html, $result);
$result = str_replace('<div>&nbsp;</div>', '', $result[0]); // $result = str_replace('<div>&nbsp;</div>', '', $result[0]);
preg_match_all("/<div>(.*?)<\/div>/is", $result, $result); // preg_match_all("/<div>(.*?)<\/div>/is", $result, $result);
foreach ($result[0] as $k => $info) { // foreach ($result[0] as $k => $info) {
$record = []; // $record = [];
$record['name'] = '无限'; // $record['name'] = '无限';
$info = ltrim($info, '<div>'); // $info = ltrim($info, '<div>');
$info = rtrim($info, '</div>'); // $info = rtrim($info, '</div>');
if (strpos($info, 'span') !== false) { // if (strpos($info, 'span') !== false) {
$data = explode('<span class="Apple-tab-span" style="white-space:pre"> </span>', $info); // $data = explode('<span class="Apple-tab-span" style="white-space:pre"> </span>', $info);
} else { // } else {
$data = explode(' &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;', $info); // $data = explode(' &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;', $info);
} // }
$data[1] = trim($data[1]); // $data[1] = trim($data[1]);
$province_detail = mb_substr(trim($data[1]), 0, 2); // $province_detail = mb_substr(trim($data[1]), 0, 2);
if (in_array($province_detail, $province)) { // if (in_array($province_detail, $province)) {
$province_detail = mb_substr($data[1], 0, 3); // $province_detail = mb_substr($data[1], 0, 3);
$data[1] = mb_substr($data[1], 3); // $data[1] = mb_substr($data[1], 3);
} elseif (!in_array($province_detail, $citys)) { // } elseif (!in_array($province_detail, $citys)) {
$data[1] = mb_substr($data[1], 2); // $data[1] = mb_substr($data[1], 2);
} // }
if (!in_array($province_detail, $province_record)) { // if (!in_array($province_detail, $province_record)) {
$record['city'] = $province_detail; // $record['city'] = $province_detail;
$province_record[] = $province_detail; // $province_record[] = $province_detail;
$key = $record['city']; // $key = $record['city'];
$list1[$key][] = $record; // $list1[$key][] = $record;
} // }
if (strpos($data[1], '电信') !== false) { // if (strpos($data[1], '电信') !== false) {
$record['city'] = explode('电信', $data[1])[0]; // $record['city'] = explode('电信', $data[1])[0];
$record['city'] = str_replace('&lt;', '', $record['city']); // $record['city'] = str_replace('&lt;', '', $record['city']);
$record['city'] = str_replace('&gt;', '', $record['city']); // $record['city'] = str_replace('&gt;', '', $record['city']);
$record['supply'] = '电信'; // $record['supply'] = '电信';
} elseif (strpos($data[1], '联通') !== false) { // } elseif (strpos($data[1], '联通') !== false) {
$record['city'] = explode('联通', $data[1])[0]; // $record['city'] = explode('联通', $data[1])[0];
$record['city'] = str_replace('&lt;', '', $record['city']); // $record['city'] = str_replace('&lt;', '', $record['city']);
$record['city'] = str_replace('&gt;', '', $record['city']); // $record['city'] = str_replace('&gt;', '', $record['city']);
$record['supply'] = '联通'; // $record['supply'] = '联通';
} elseif (strpos($data[1], '移动') !== false) { // } elseif (strpos($data[1], '移动') !== false) {
$record['city'] = explode('移动', $data[1])[0]; // $record['city'] = explode('移动', $data[1])[0];
$record['city'] = str_replace('&lt;', '', $record['city']); // $record['city'] = str_replace('&lt;', '', $record['city']);
$record['city'] = str_replace('&gt;', '', $record['city']); // $record['city'] = str_replace('&gt;', '', $record['city']);
$record['supply'] = '移动'; // $record['supply'] = '移动';
} else { // } else {
$record['city'] = $data[1]; // $record['city'] = $data[1];
$record['city'] = str_replace('&lt;', '', $record['city']); // $record['city'] = str_replace('&lt;', '', $record['city']);
$record['city'] = str_replace('&gt;', '', $record['city']); // $record['city'] = str_replace('&gt;', '', $record['city']);
$record['supply'] = '电信/联通'; // $record['supply'] = '电信/联通';
} // }
$record['ip'] = ''; // $record['ip'] = '';
$record['daikuan'] = ''; // $record['daikuan'] = '';
$record['onlineuser'] = ''; // $record['onlineuser'] = '';
$record['maxuser'] = ''; // $record['maxuser'] = '';
$record['online'] = ''; // $record['online'] = '';
$record['status'] = ''; // $record['status'] = '';
$record['nasname'] = $data[0]; // $record['nasname'] = $data[0];
if (!in_array($record['nasname'], $exit) && !in_array($record['nasname'], $dnx_has_exit)) { // if (!in_array($record['nasname'], $exit) && !in_array($record['nasname'], $dnx_has_exit)) {
fputcsv($dnx_exit, ['无限', $record['nasname'], date('Y-m-d H:i:s')]); // fputcsv($dnx_exit, ['无限', $record['nasname'], date('Y-m-d H:i:s')]);
} // }
$list1[$key][] = $record; // $list1[$key][] = $record;
} // }
foreach ($list1 as $val) { // foreach ($list1 as $val) {
foreach ($val as $net_data) { // foreach ($val as $net_data) {
$net_data['city'] = str_replace('电信', '', $net_data['city']); // $net_data['city'] = str_replace('电信', '', $net_data['city']);
$net_data['city'] = str_replace('联通', '', $net_data['city']); // $net_data['city'] = str_replace('联通', '', $net_data['city']);
fputcsv($file, $net_data); // fputcsv($file, $net_data);
fputcsv($all, $net_data); // fputcsv($all, $net_data);
} // }
} // }
} }
function xianfeng_getList($data, &$file, &$all, $exit) function xianfeng_getList($data, &$file, &$all, $exit)