老鹰线路表

This commit is contained in:
“wanyongkang”
2021-03-26 15:52:54 +08:00
parent 005dbaf74f
commit c25866717d

View File

@@ -7,7 +7,6 @@
* @LastEditors: Please set LastEditors
* @LastEditTime: 2020-12-05 17:34:41
*/
$is_script = 1;
include_once __DIR__ . '/../../index.php';
include_once __DIR__ . '/auto_format.php';
@@ -15,31 +14,13 @@ use app\api\model\Product;
$product_model = new Product;
$product_list = $product_model->field('Id,Token')->fetchAll();
// // //测试用
// $time = time();
// $noce = md5(time());
// $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)['data'];
// print_r($xingxing);die;
// if(!empty($qiangzi)){
// $qiangzi_data = get_product(__DIR__ . '/data/qiangzi.csv');
// $qiangzi_f = fopen(__DIR__ . '/data/qiangzi.csv', 'w');
// // //测试用----------------------------------------------------------------------------------------------------------
// //写入强子文件
// qiangzi_getList($qiangzi, $qiangzi_f, $all, $qiangzi_data);
// fclose($qiangzi_f);
// }
// $time = time();
// $noce = md5(time());
// $apikey = 'osoa917321hdjw';
// $sign = md5($time.$noce.$apikey);
// $url = "http://47.92.65.184:2223/api/getNodeList?agentid=admin2&ti=".$time."&nonce=".$noce."&sign=".$sign;
// $xunlian = json_decode(file_get_contents($url), true)['data'];
// print_r($xunlian);die;
// $laoying_data = get_product(__DIR__ . '/data/laoying.csv');
// $laoying_f = fopen(__DIR__ . '/data/laoying.csv', 'w');
// $laoying = file_get_contents('http://list.wzvps.com/');
// //写入老鹰文件
// laoying_getList($laoying, $laoying_f, $all, $laoying_data);
// die;
@@ -124,17 +105,17 @@ fclose($mogu_f);
$laoying_data = get_product(__DIR__ . '/data/laoying.csv');
$laoying_f = fopen(__DIR__ . '/data/laoying.csv', 'w');
$laoying = json_decode(get_content('https://dl.ipduoduo.com/api/area?_=1604541004026', $product_list[4]['Token']), true)['data'];
$laoying = file_get_contents('http://list.wzvps.com/');
//写入老鹰文件
tiantian_getList($laoying, $laoying_f, $all, $laoying_data, '老鹰');
laoying_getList($laoying, $laoying_f, $all, $laoying_data);
fclose($laoying_f);
$shihui_data = get_product(__DIR__ . '/data/shihui.csv');
$shihui_f = fopen(__DIR__ . '/data/shihui.csv', 'w');
$shihui = get_content('http://39.96.182.192:8888/agent.html', $product_list[15]['Token']);
//写入实惠文件
shihui_getList($shihui, $shihui_f, $all, $shihui_data);
fclose($shihui_f);
// $shihui_data = get_product(__DIR__ . '/data/shihui.csv');
// $shihui_f = fopen(__DIR__ . '/data/shihui.csv', 'w');
// $shihui = get_content('http://39.96.182.192:8888/agent.html', $product_list[15]['Token']);
// //写入实惠文件
// shihui_getList($shihui, $shihui_f, $all, $shihui_data);
// fclose($shihui_f);
$gongxiang_data = get_product(__DIR__ . '/data/gongxiang.csv');
$gongxiang_f = fopen(__DIR__ . '/data/gongxiang.csv', 'w');
@@ -485,59 +466,112 @@ function mogu_getList($data, &$file, &$all, $exit, $product_name)
}
function shihui_getList($html, &$file, &$all, $exit)
function laoying_getList($html, &$file, &$all, $exit)
{
// global $dnx_exit, $dnx_has_exit;
// $key = '';
// $list1 = [];
// preg_match("/<p>(.*\s*?)<p>&nbsp;<\/p><\/div>/is", $html, $result);
// preg_match_all("/<p>(.*?)<\/p>/is", $result[0], $result);
// foreach ($result[0] as $k => $info) {
// $record = [];
// $record['name'] = '实惠';
// if ($k == 0 || $k == 5) {
// continue;
// } else {
// $list = explode('<br />', $info);
// $i = 0;
// foreach ($list as $v) {
// $v = trim($v);
// $v = trim(str_replace('&nbsp;', '', $v), '</p>');
// if ($i == 0 && !empty($v)) {
// $record['city'] = $v;
// $key = $record['city'];
// $list1[$key][] = $record;
// } else {
global $dnx_exit, $dnx_has_exit;
$key = '';
$list1 = [];
preg_match("/<tbody>(.*\s*?)<\/tbody>/is", $html, $result);
preg_match_all("/<tr>(.*?)<\/tr>/is", $result[1], $result_info);
$province_record = [];
foreach ($result_info[1] as $k => $info) {
//生成数据
$record = [];
$record['name'] = '老鹰';
// if (!empty($v)) {
// $data = explode(' ', $v);
// $add_data = explode('市', $data[0]);
// $record['city'] = mb_substr($add_data[0], 2);
// $record['supply'] = $add_data[1];
// $record['ip'] = '';
// $record['daikuan'] = '';
// $record['onlineuser'] = '';
// $record['maxuser'] = '';
// $record['online'] = '';
// $record['status'] = '';
// $record['nasname'] = $data[count($data) - 1];
// 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')]);
// }
// $list1[$key][] = $record;
// }
// }
// $i++;
// }
// }
// }
// foreach ($list1 as $val) {
// foreach ($val as $net_data) {
$jiexi_data = [];
//数据解析
$temp = [];
preg_match("/<td class=\"text-center\">(.*?)<\/td>/is", $info, $address_html);
preg_match("/<span class=\"badge badge-success\">(.*?)<\/span>/is", $info, $status_html);
preg_match_all("/<td class=\"d-none d-sm-table-cell text-center\">(.*?)<\/td>/is", $info, $nas_html);
$jiexi_data['address'] = trim($address_html[1]);
$jiexi_data['status'] = trim($status_html[1])=='正常运行'?'正常':'故障';;
$jiexi_data['nasname'] = trim($nas_html[1][1]);
// fputcsv($file, $net_data);
// fputcsv($all, $net_data);
// }
// }
//运营商
if (strpos($jiexi_data['address'], '电信') !== false) {
$supply = '电信';
$jiexi_data['address'] = mb_substr($jiexi_data['address'], 0, mb_strlen($jiexi_data['address']) - 2);
} elseif (strpos($jiexi_data['address'], '联通') !== false) {
$supply = '联通';
$jiexi_data['address'] = mb_substr($jiexi_data['address'], 0, mb_strlen($jiexi_data['address']) - 2);
} elseif (strpos($jiexi_data['address'], '移动') !== false) {
$supply = '移动';
$jiexi_data['address'] = mb_substr($jiexi_data['address'], 0, mb_strlen($jiexi_data['address']) - 2);
} else {
$supply = '电信/联通';
}
if (strpos($jiexi_data['address'], '混拨') !== false) {
if (!in_array('混拨', $province_record)) {
$record['city'] = '混拨';
$province_record[] = '混拨';
$key = $record['city'];
$list1[$key][] = $record;
}
$temp['city'] = $jiexi_data['address'];
$temp['status'] = $jiexi_data['status'];
$temp['nasname'] = $jiexi_data['nasname'];
} elseif (strpos($jiexi_data['address'], '省') !== false) {
$add_explode = explode('省',$jiexi_data['address']);
if (!in_array($add_explode[0], $province_record)) {
$record['city'] = $add_explode[0];
$province_record[] = $add_explode[0];
$key = $record['city'];
$list1[$key][] = $record;
}
$temp['city'] = $add_explode[1];
$temp['status'] = $jiexi_data['status'];
$temp['nasname'] = $jiexi_data['nasname'];
} elseif (strpos($jiexi_data['address'], '自治区') !== false) {
$add_explode = explode('自治区',$jiexi_data['address']);
if (!in_array($add_explode[0], $province_record)) {
$record['city'] = $add_explode[0];
$province_record[] = $add_explode[0];
$key = $record['city'];
$list1[$key][] = $record;
}
$temp['city'] = $add_explode[1];
$temp['status'] = $jiexi_data['status'];
$temp['nasname'] = $jiexi_data['nasname'];
} elseif (strpos($jiexi_data['address'], '市') !== false) {
$add_explode = explode('市',$jiexi_data['address']);
if (!in_array($add_explode[0], $province_record)) {
$record['city'] = $add_explode[0];
$province_record[] = $add_explode[0];
$key = $record['city'];
$list1[$key][] = $record;
}
$temp['city'] = $add_explode[1];
$temp['status'] = $jiexi_data['status'];
$temp['nasname'] = $jiexi_data['nasname'];
}
$record['city'] =$temp['city'];
$record['supply'] = $supply;
$record['ip'] = '';
$record['daikuan'] = '';
$record['onlineuser'] = '';
$record['maxuser'] = '';
$record['online'] = $temp['status'];
$record['status'] = '';
$record['nasname'] = $temp['nasname'];
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')]);
}
$list1[$key][] = $record;
}
foreach ($list1 as $val) {
foreach ($val as $net_data) {
fputcsv($file, $net_data);
fputcsv($all, $net_data);
}
}
}
//共享