先锋 神龙
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
* @Author: kangkang
|
||||
* @Date: 2020-11-03 11:04:15
|
||||
* @LastEditors: “wanyongkang” “937888580@qq.com”
|
||||
* @LastEditTime: 2023-12-29 16:11:22
|
||||
* @LastEditTime: 2024-01-04 15:30:18
|
||||
*/
|
||||
$is_script = 1;
|
||||
include_once __DIR__ . '/../../index.php';
|
||||
@@ -13,18 +13,20 @@ include_once __DIR__ . '/auto_format.php';
|
||||
|
||||
// // //测试用----------------------------------------------------------------------------------------------------------
|
||||
|
||||
//猎豹
|
||||
// $liebao = json_decode(file_get_contents("https://xmapi.xingmojs.com/ppp/v1/areas?apiid=130&sendtime=" . time() . "&sign=" . md5('apiid=130&sendtime=' . time() . '3AT7XCHjWG8sSMpRBjtAJ8JRkSAbhJit')), true)['data'];
|
||||
// //先锋
|
||||
// $xianfeng = json_decode(file_get_contents("http://service.shenlongip.com/api/server/getlist"), true)['P'];
|
||||
|
||||
// if($liebao){
|
||||
// $liebao_data = get_product(__DIR__ . '/data/liebao.csv');
|
||||
// $liebao_f = fopen(__DIR__ . '/data/liebao.csv', 'w');
|
||||
// //写入天天文件
|
||||
// liebao_getList($liebao, $liebao_f, $all, $liebao_data, '猎豹');
|
||||
// fclose($liebao_f);
|
||||
|
||||
// if($xianfeng){
|
||||
// $xianfeng_data = get_product(__DIR__ . '/data/xianfeng.csv');
|
||||
// $xianfeng_f = fopen(__DIR__ . '/data/xianfeng.csv', 'w');
|
||||
// //写入先锋文件
|
||||
// xianfeng_getList($xianfeng, $xianfeng_f, $all, $xianfeng_data);
|
||||
// fclose($xianfeng_f);
|
||||
// }
|
||||
// die;
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
$dnx_has_exit = [];
|
||||
//强子迅联特征码
|
||||
$sp_xl_code = file_get_contents(__DIR__ . '/data/xl.txt', 'r');
|
||||
|
||||
@@ -138,8 +140,18 @@ if(!empty($yunniu)){
|
||||
fclose($yunniu_f);
|
||||
}
|
||||
|
||||
//先锋
|
||||
$xianfeng = json_decode(file_get_contents("http://service.shenlongip.com/api/server/getlist"), true)['P'];
|
||||
|
||||
|
||||
if($xianfeng){
|
||||
$xianfeng_data = get_product(__DIR__ . '/data/xianfeng.csv');
|
||||
$xianfeng_f = fopen(__DIR__ . '/data/xianfeng.csv', 'w');
|
||||
//写入先锋文件
|
||||
xianfeng_getList($xianfeng, $xianfeng_f, $all, $xianfeng_data);
|
||||
fclose($xianfeng_f);
|
||||
}
|
||||
|
||||
|
||||
// $time = time();
|
||||
// $noce = md5(time());
|
||||
@@ -196,17 +208,6 @@ fclose($liebao_f);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$xianfeng = json_decode(file_get_contents("http://apiserver.pptp.biz/Apiserver/getserver"), true);
|
||||
if($xianfeng){
|
||||
$xianfeng_data = get_product(__DIR__ . '/data/xianfeng.csv');
|
||||
$xianfeng_f = fopen(__DIR__ . '/data/xianfeng.csv', 'w');
|
||||
//写入先锋文件
|
||||
xianfeng_getList($xianfeng, $xianfeng_f, $all, $xianfeng_data);
|
||||
fclose($xianfeng_f);
|
||||
}
|
||||
|
||||
// $jinrui_data = get_product(__DIR__ . '/data/jinrui.csv');
|
||||
// $jinrui_f = fopen(__DIR__ . '/data/jinrui.csv', 'w');
|
||||
// $jinrui = file_get_contents("http://pptp.zhekou5.com/api/getnas.php");
|
||||
@@ -1117,6 +1118,74 @@ function xunlian_getList($data, &$file, &$all, $exit)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function xianfeng_getList($data, &$file, &$all, $exit)
|
||||
{
|
||||
global $dnx_exit, $dnx_has_exit,$sp_xl_list;
|
||||
|
||||
$key = '';
|
||||
$list1 = [];
|
||||
$province_record = [];
|
||||
|
||||
foreach ($data as $info) {
|
||||
$record = [];
|
||||
$record['name'] = '先锋';
|
||||
//如果存在 不为空 则
|
||||
$city_name = explode('-',$info['name']);
|
||||
if (strpos($city_name[1], '混播') !== false) {
|
||||
|
||||
//如果存在 不为空 则
|
||||
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'] = isset($city_name[2]) ? trim($city_name[2]) : '';
|
||||
|
||||
$daikuan = '';
|
||||
$record['ip'] = '';
|
||||
$record['daikuan'] = $daikuan;
|
||||
$record['onlineuser'] = '';
|
||||
$record['maxuser'] = '';
|
||||
$record['online'] = '正常';
|
||||
|
||||
$record['status'] = '';
|
||||
$record['nasname'] = trim($info['server']);
|
||||
|
||||
if (!in_array($record['nasname'], $exit) && !in_array($record['nasname'], $dnx_has_exit)) {
|
||||
fputcsv($dnx_exit, ['先锋', 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) {
|
||||
|
||||
fputcsv($file, $net_data);
|
||||
fputcsv($all, $net_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
function wuxian_getList($html, &$file, &$all, $exit)
|
||||
{
|
||||
// global $dnx_exit, $dnx_has_exit;
|
||||
@@ -1200,92 +1269,6 @@ function wuxian_getList($html, &$file, &$all, $exit)
|
||||
// }
|
||||
}
|
||||
|
||||
function xianfeng_getList($data, &$file, &$all, $exit)
|
||||
{
|
||||
global $dnx_exit, $dnx_has_exit;
|
||||
//省会
|
||||
$province = ['黑龙', '内蒙', '直辖'];
|
||||
$province_record = [];
|
||||
$key = '';
|
||||
$list1 = [];
|
||||
$status = ['维护中', '正常'];
|
||||
foreach ($data as $info) {
|
||||
$record = [];
|
||||
$record['name'] = '先锋';
|
||||
|
||||
$info['description'] = trim($info['description'], 'a');
|
||||
if (strpos($info['description'], '混播') || strpos($info['description'], '所有单城市')) {
|
||||
$province_detail = '混播';
|
||||
if (!in_array($province_detail, $province_record)) {
|
||||
$record['city'] = $province_detail;
|
||||
$province_record[] = $province_detail;
|
||||
$key = $record['city'];
|
||||
$list1[$key][] = $record;
|
||||
}
|
||||
$record['city'] = $info['description'];
|
||||
$record['supply'] = '电信/联通';
|
||||
} else {
|
||||
$province_detail = mb_substr(trim($info['description']), 0, 2);
|
||||
if (in_array($province_detail, $province)) {
|
||||
$province_detail = mb_substr($info['description'], 0, 3);
|
||||
}
|
||||
if (!in_array($province_detail, $province_record)) {
|
||||
$record['city'] = $province_detail;
|
||||
$province_record[] = $province_detail;
|
||||
$key = $record['city'];
|
||||
$list1[$key][] = $record;
|
||||
}
|
||||
$key = $province_detail;
|
||||
if (strpos($info['description'], '电信') !== false) {
|
||||
$record['city'] = $info['description'];
|
||||
$record['supply'] = '电信';
|
||||
} elseif (strpos($info['description'], '联通') !== false) {
|
||||
$record['city'] = $info['description'];
|
||||
$record['supply'] = '联通';
|
||||
} elseif (strpos($info['description'], '移动') !== false) {
|
||||
$record['city'] = $info['description'];
|
||||
$record['supply'] = '移动';
|
||||
} else {
|
||||
$record['city'] = $info['description'];
|
||||
$record['supply'] = '电信/联通';
|
||||
}
|
||||
}
|
||||
$record['ip'] = '';
|
||||
$record['daikuan'] = $info['description2'];
|
||||
$record['onlineuser'] = $info['onlineuser'];
|
||||
$record['maxuser'] = $info['maxuser'];
|
||||
$record['online'] = ($info['status'] == 1) ? '正常' : '故障';
|
||||
$status_flag = $info['onlineuser'] / $info['maxuser'];
|
||||
$record['status'] = '';
|
||||
if ($status_flag < 0.9) {
|
||||
$record['status'] = '正常';
|
||||
} elseif ($status_flag < 0.1) {
|
||||
$record['status'] = '拥挤';
|
||||
} else {
|
||||
$record['status'] = '满载';
|
||||
}
|
||||
$record['nasname'] = $info['nasname'];
|
||||
if (!in_array($record['nasname'], $exit) && !in_array($record['nasname'], $dnx_has_exit)) {
|
||||
fputcsv($dnx_exit, ['先锋', 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) {
|
||||
|
||||
$net_data['city'] = str_replace('电信', '', $net_data['city']);
|
||||
$net_data['city'] = str_replace('联通', '', $net_data['city']);
|
||||
|
||||
if (mb_strlen($net_data['city']) > 3 && !strpos($net_data['city'], '省内')) {
|
||||
$net_data['city'] = mb_substr($net_data['city'], 3);
|
||||
}
|
||||
|
||||
fputcsv($file, $net_data);
|
||||
fputcsv($all, $net_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function jinrui_getList($html, &$file, &$all, $exit)
|
||||
{
|
||||
global $dnx_exit, $dnx_has_exit;
|
||||
|
||||
Reference in New Issue
Block a user