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