线路表
This commit is contained in:
@@ -15,19 +15,10 @@ $product_model = new Product;
|
||||
$product_list = $product_model->field('Id,Token')->fetchAll();
|
||||
|
||||
// //测试用----------------------------------------------------------------------------------------------------------
|
||||
// $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'];
|
||||
// if ($xunlian){
|
||||
// $xunlian_data = get_product(__DIR__ . '/data/xunlian.csv');
|
||||
// $xunlian_f = fopen(__DIR__ . '/data/xunlian.csv', 'w');
|
||||
// //写入讯连文件
|
||||
// xunlian_getList($xunlian, $xunlian_f, $all, $xunlian_data);
|
||||
// fclose($xunlian_f);
|
||||
// }
|
||||
// $apikey = '80cf4f64e990b78a9fc5eb';
|
||||
// $url = "http://rds-api.juip.com/server/index/getList?apikey=".$apikey;
|
||||
// $mogu = json_decode(file_get_contents($url), true)['data'];
|
||||
// mogu_getList($mogu, $mogu_f, $all, $mogu_data, '蘑菇');
|
||||
// die;
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//强子迅联特征码
|
||||
@@ -59,6 +50,16 @@ foreach($sp_qz_json as $k=>$v){
|
||||
$all = fopen(__DIR__ . '/data/all.csv', 'w');
|
||||
$dnx_exit = fopen(__DIR__ . '/data/dns_diff.csv', 'a');
|
||||
$dnx_has_exit = get_product(__DIR__ . '/data/dns_diff.csv', 1);
|
||||
//-----------------------------------------------------------------------------------------------------
|
||||
$apikey = '80cf4f64e990b78a9fc5eb';
|
||||
$url = "http://rds-api.juip.com/server/index/getList?apikey=".$apikey;
|
||||
$mogu_data = get_product(__DIR__ . '/data/mogu.csv');
|
||||
$mogu_f = fopen(__DIR__ . '/data/mogu.csv', 'w');
|
||||
$mogu = json_decode(file_get_contents($url), true)['data'];
|
||||
mogu_getList($mogu, $mogu_f, $all, $mogu_data);
|
||||
fclose($mogu_f);
|
||||
die;
|
||||
|
||||
|
||||
$time = time();
|
||||
$noce = md5(time());
|
||||
@@ -155,17 +156,10 @@ tiantian_getList($tiantian, $tiantian_f, $all, $tiantian_data, '天天');
|
||||
fclose($tiantian_f);
|
||||
}
|
||||
|
||||
$mogu = json_decode(get_content("http://xjip.hlapi.com/api/area",''), true)['data'];
|
||||
if($mogu){
|
||||
$mogu_data = get_product(__DIR__ . '/data/mogu.csv');
|
||||
$mogu_f = fopen(__DIR__ . '/data/mogu.csv', 'w');
|
||||
// echo 123;
|
||||
// print_r($mogu);
|
||||
//写入蘑菇文件
|
||||
mogu_getList($mogu, $mogu_f, $all, $mogu_data, '蘑菇');
|
||||
fclose($mogu_f);
|
||||
}
|
||||
|
||||
$apikey = '80cf4f64e990b78a9fc5eb';
|
||||
$url = "http://rds-api.juip.com/server/index/getList?apikey=".$apikey;
|
||||
$mogu = json_decode(file_get_contents($url), true)['data'];
|
||||
mogu_getList($mogu, $mogu_f, $all, $mogu_data, '蘑菇');
|
||||
|
||||
// $laoying = file_get_contents('http://list.wzvps.com/');
|
||||
// if($laoying){
|
||||
@@ -260,6 +254,7 @@ function qiangzi_getList($data, &$file, &$all, $exit)
|
||||
$key = $record['city'];
|
||||
$list1[$key][] = $record;
|
||||
}
|
||||
$key = $city_name[0];
|
||||
}
|
||||
|
||||
|
||||
@@ -523,48 +518,60 @@ function tiantian_getList($data, &$file, &$all, $exit, $product_name)
|
||||
|
||||
|
||||
//蘑菇服务器解析规则
|
||||
function mogu_getList($data, &$file, &$all, $exit, $product_name)
|
||||
function mogu_getList($data, &$file, &$all, $exit, $product_name='蘑菇')
|
||||
{
|
||||
global $dnx_exit, $dnx_has_exit;
|
||||
$status = ['故障', '正常'];
|
||||
$key = '';
|
||||
$list1 = [];
|
||||
// print_r($data);
|
||||
|
||||
$province_record = [];
|
||||
|
||||
foreach ($data as $info) {
|
||||
|
||||
$record = [];
|
||||
$record['name'] = $product_name;
|
||||
$record['city'] = $info['title'];
|
||||
$key = $record['city'];
|
||||
$list1[$key][] = $record;
|
||||
foreach ($info['children'] as $v) {
|
||||
|
||||
if (strpos($v['title'], '电信') !== false) {
|
||||
$record['city'] = explode('电信', $v['title'])[0];
|
||||
$record['supply'] = '电信';
|
||||
} elseif (strpos($v['title'], '联通') !== false) {
|
||||
$record['city'] = explode('联通', $v['title'])[0];
|
||||
$record['supply'] = '联通';
|
||||
} elseif (strpos($v['title'], '移动') !== false) {
|
||||
$record['city'] = explode('移动', $v['title'])[0];
|
||||
$record['supply'] = '移动';
|
||||
} else {
|
||||
$record['city'] = $v['title'];
|
||||
$record['supply'] = '电信/联通';
|
||||
}
|
||||
$record['ip'] = '';
|
||||
$record['daikuan'] = $v['bandwidth'];
|
||||
$record['onlineuser'] = '';
|
||||
$record['maxuser'] = '';
|
||||
$record['online'] = $v['status'] ? '正常' : '故障';
|
||||
$record['status'] = '';
|
||||
$record['nasname'] = $v['address'][0];
|
||||
if (!in_array($record['nasname'], $exit) && !in_array($record['nasname'], $dnx_has_exit)) {
|
||||
fputcsv($dnx_exit, [$product_name, explode('.',$record['nasname'])[0], $record['nasname'], date('Y-m-d H:i:s')]);
|
||||
}
|
||||
$list1[$key][] = $record;
|
||||
$record['name'] = '蘑菇';
|
||||
//如果存在 不为空 则
|
||||
$city_name = explode('-',$info['city']);
|
||||
if(empty($info['city'])) {
|
||||
continue;
|
||||
}
|
||||
if ($city_name[0]== '混拨') {
|
||||
|
||||
//如果存在 不为空 则
|
||||
if (!in_array( $city_name[1], $province_record)) {
|
||||
$record['city'] = $city_name[1];
|
||||
$province_record[] = $city_name[1];
|
||||
$key = $record['city'];
|
||||
$list1[$key][] = $record;
|
||||
}
|
||||
} else {
|
||||
//如果存在 不为空 则
|
||||
if (!in_array( $city_name[0], $province_record)) {
|
||||
$record['city'] = $city_name[0];
|
||||
$province_record[] = $city_name[0];
|
||||
$key = $record['city'];
|
||||
$list1[$key][] = $record;
|
||||
}
|
||||
$key = $city_name[0];
|
||||
}
|
||||
|
||||
$record['city'] = $city_name[1];
|
||||
$record['supply'] = $info['yunying'];
|
||||
|
||||
$record['ip'] = '';
|
||||
$record['daikuan'] = $info['daikuan'];
|
||||
$record['onlineuser'] = '';
|
||||
$record['maxuser'] = '';
|
||||
$record['online'] = $info['status'] ? '正常' : '故障';
|
||||
$record['status'] = '';
|
||||
$record['nasname'] = $info['address'];
|
||||
if (!in_array($record['nasname'], $exit) && !in_array($record['nasname'], $dnx_has_exit)) {
|
||||
fputcsv($dnx_exit, [$product_name, explode('.',$record['nasname'])[0], $record['nasname'], date('Y-m-d H:i:s')]);
|
||||
}
|
||||
$list1[$key][] = $record;
|
||||
}
|
||||
foreach ($list1 as $val) {
|
||||
foreach ($val as $net_data) {
|
||||
|
||||
Reference in New Issue
Block a user