老鹰线路表
This commit is contained in:
@@ -7,7 +7,6 @@
|
|||||||
* @LastEditors: Please set LastEditors
|
* @LastEditors: Please set LastEditors
|
||||||
* @LastEditTime: 2020-12-05 17:34:41
|
* @LastEditTime: 2020-12-05 17:34:41
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$is_script = 1;
|
$is_script = 1;
|
||||||
include_once __DIR__ . '/../../index.php';
|
include_once __DIR__ . '/../../index.php';
|
||||||
include_once __DIR__ . '/auto_format.php';
|
include_once __DIR__ . '/auto_format.php';
|
||||||
@@ -15,31 +14,13 @@ use app\api\model\Product;
|
|||||||
$product_model = new Product;
|
$product_model = new Product;
|
||||||
$product_list = $product_model->field('Id,Token')->fetchAll();
|
$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');
|
|
||||||
|
|
||||||
// //写入强子文件
|
// $laoying_data = get_product(__DIR__ . '/data/laoying.csv');
|
||||||
// qiangzi_getList($qiangzi, $qiangzi_f, $all, $qiangzi_data);
|
// $laoying_f = fopen(__DIR__ . '/data/laoying.csv', 'w');
|
||||||
// fclose($qiangzi_f);
|
// $laoying = file_get_contents('http://list.wzvps.com/');
|
||||||
// }
|
// //写入老鹰文件
|
||||||
|
// laoying_getList($laoying, $laoying_f, $all, $laoying_data);
|
||||||
|
|
||||||
// $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;
|
|
||||||
|
|
||||||
// die;
|
// die;
|
||||||
|
|
||||||
@@ -124,17 +105,17 @@ fclose($mogu_f);
|
|||||||
|
|
||||||
$laoying_data = get_product(__DIR__ . '/data/laoying.csv');
|
$laoying_data = get_product(__DIR__ . '/data/laoying.csv');
|
||||||
$laoying_f = fopen(__DIR__ . '/data/laoying.csv', 'w');
|
$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);
|
fclose($laoying_f);
|
||||||
|
|
||||||
$shihui_data = get_product(__DIR__ . '/data/shihui.csv');
|
// $shihui_data = get_product(__DIR__ . '/data/shihui.csv');
|
||||||
$shihui_f = fopen(__DIR__ . '/data/shihui.csv', 'w');
|
// $shihui_f = fopen(__DIR__ . '/data/shihui.csv', 'w');
|
||||||
$shihui = get_content('http://39.96.182.192:8888/agent.html', $product_list[15]['Token']);
|
// $shihui = get_content('http://39.96.182.192:8888/agent.html', $product_list[15]['Token']);
|
||||||
//写入实惠文件
|
// //写入实惠文件
|
||||||
shihui_getList($shihui, $shihui_f, $all, $shihui_data);
|
// shihui_getList($shihui, $shihui_f, $all, $shihui_data);
|
||||||
fclose($shihui_f);
|
// fclose($shihui_f);
|
||||||
|
|
||||||
$gongxiang_data = get_product(__DIR__ . '/data/gongxiang.csv');
|
$gongxiang_data = get_product(__DIR__ . '/data/gongxiang.csv');
|
||||||
$gongxiang_f = fopen(__DIR__ . '/data/gongxiang.csv', 'w');
|
$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;
|
global $dnx_exit, $dnx_has_exit;
|
||||||
// $key = '';
|
$key = '';
|
||||||
// $list1 = [];
|
$list1 = [];
|
||||||
// preg_match("/<p>(.*\s*?)<p> <\/p><\/div>/is", $html, $result);
|
preg_match("/<tbody>(.*\s*?)<\/tbody>/is", $html, $result);
|
||||||
// preg_match_all("/<p>(.*?)<\/p>/is", $result[0], $result);
|
preg_match_all("/<tr>(.*?)<\/tr>/is", $result[1], $result_info);
|
||||||
// foreach ($result[0] as $k => $info) {
|
|
||||||
// $record = [];
|
$province_record = [];
|
||||||
// $record['name'] = '实惠';
|
foreach ($result_info[1] as $k => $info) {
|
||||||
// if ($k == 0 || $k == 5) {
|
|
||||||
// continue;
|
//生成数据
|
||||||
// } else {
|
$record = [];
|
||||||
// $list = explode('<br />', $info);
|
$record['name'] = '老鹰';
|
||||||
// $i = 0;
|
|
||||||
// foreach ($list as $v) {
|
|
||||||
// $v = trim($v);
|
|
||||||
// $v = trim(str_replace(' ', '', $v), '</p>');
|
|
||||||
// if ($i == 0 && !empty($v)) {
|
|
||||||
// $record['city'] = $v;
|
|
||||||
// $key = $record['city'];
|
|
||||||
// $list1[$key][] = $record;
|
|
||||||
// } else {
|
|
||||||
|
|
||||||
// if (!empty($v)) {
|
$jiexi_data = [];
|
||||||
// $data = explode(' ', $v);
|
//数据解析
|
||||||
// $add_data = explode('市', $data[0]);
|
$temp = [];
|
||||||
// $record['city'] = mb_substr($add_data[0], 2);
|
preg_match("/<td class=\"text-center\">(.*?)<\/td>/is", $info, $address_html);
|
||||||
// $record['supply'] = $add_data[1];
|
preg_match("/<span class=\"badge badge-success\">(.*?)<\/span>/is", $info, $status_html);
|
||||||
// $record['ip'] = '';
|
preg_match_all("/<td class=\"d-none d-sm-table-cell text-center\">(.*?)<\/td>/is", $info, $nas_html);
|
||||||
// $record['daikuan'] = '';
|
$jiexi_data['address'] = trim($address_html[1]);
|
||||||
// $record['onlineuser'] = '';
|
$jiexi_data['status'] = trim($status_html[1])=='正常运行'?'正常':'故障';;
|
||||||
// $record['maxuser'] = '';
|
$jiexi_data['nasname'] = trim($nas_html[1][1]);
|
||||||
// $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) {
|
|
||||||
|
|
||||||
// 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//共享
|
//共享
|
||||||
|
|||||||
Reference in New Issue
Block a user