修改猎豹服务器列表

This commit is contained in:
“wanyongkang”
2025-04-19 17:40:10 +08:00
parent b3c2ad57a8
commit c53518b1d1

View File

@@ -108,16 +108,24 @@ if ($qilin_api_data) {
//猎豹 //猎豹
$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']; $url = "http://106.119.166.87:18702/api/agent/getList2?apikey=80cf4f64e990b78a9fc5eb";
$liebao = json_decode(file_get_contents($url), true)['data'];
if ($liebao) { if ($liebao) {
$liebao_data = get_product(__DIR__ . '/data/liebao.csv');
$liebao_f = fopen(__DIR__ . '/data/liebao.csv', 'w'); $liebao_f = fopen(__DIR__ . '/data/liebao.csv', 'w');
//写入天天文件 liebao_getList($liebao, $liebao_f, $all);
liebao_getList($liebao, $liebao_f, $all, $liebao_data, '猎豹');
fclose($liebao_f); fclose($liebao_f);
} }
// $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'];
// 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);
// }
// //先锋 // //先锋
// $xianfeng = json_decode(file_get_contents("http://service.shenlongip.com/api/server/getlist"), true)['P']; // $xianfeng = json_decode(file_get_contents("http://service.shenlongip.com/api/server/getlist"), true)['P'];
@@ -752,56 +760,56 @@ function tiantian_getList($data, &$file, &$all, $exit, $product_name)
} }
//天天服务器解析规则 // //天天服务器解析规则
function liebao_getList($data, &$file, &$all, $exit, $product_name) // function liebao_getList($data, &$file, &$all, $exit, $product_name)
{ // {
global $dnx_exit, $dnx_has_exit; // global $dnx_exit, $dnx_has_exit;
$status = ['故障', '正常']; // $status = ['故障', '正常'];
$key = ''; // $key = '';
$list1 = []; // $list1 = [];
foreach ($data as $info) { // foreach ($data as $info) {
$record = []; // $record = [];
$record['name'] = $product_name; // $record['name'] = $product_name;
$record['city'] = $info['name']; // $record['city'] = $info['name'];
$key = $record['city']; // $key = $record['city'];
$list1[$key][] = $record; // $list1[$key][] = $record;
foreach ($info['areas'] as $v) { // foreach ($info['areas'] as $v) {
if (strpos($v['name'], '电信') !== false) { // if (strpos($v['name'], '电信') !== false) {
$record['city'] = $v['name']; // $record['city'] = $v['name'];
$record['supply'] = '电信'; // $record['supply'] = '电信';
} elseif (strpos($v['name'], '联通') !== false) { // } elseif (strpos($v['name'], '联通') !== false) {
$record['city'] = $v['name']; // $record['city'] = $v['name'];
$record['supply'] = '联通'; // $record['supply'] = '联通';
} elseif (strpos($v['name'], '移动') !== false) { // } elseif (strpos($v['name'], '移动') !== false) {
$record['city'] = $v['name']; // $record['city'] = $v['name'];
$record['supply'] = '移动'; // $record['supply'] = '移动';
} else { // } else {
$record['city'] = $v['name']; // $record['city'] = $v['name'];
$record['supply'] = '电信/联通'; // $record['supply'] = '电信/联通';
} // }
$record['ip'] = ''; // $record['ip'] = '';
$record['daikuan'] = ''; // $record['daikuan'] = '';
$record['onlineuser'] = ''; // $record['onlineuser'] = '';
$record['maxuser'] = ''; // $record['maxuser'] = '';
$record['online'] = empty($v['status']) ? '故障' : $status[$v['status']]; // $record['online'] = empty($v['status']) ? '故障' : $status[$v['status']];
$record['status'] = ''; // $record['status'] = '';
$record['nasname'] = $v['address']; // $record['nasname'] = $v['address'];
if (!in_array($record['nasname'], $exit) && !in_array($record['nasname'], $dnx_has_exit)) { // 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')]); // fputcsv($dnx_exit, [$product_name, explode('.',$record['nasname'])[0], $record['nasname'], date('Y-m-d H:i:s')]);
} // }
$list1[$key][] = $record; // $list1[$key][] = $record;
} // }
} // }
foreach ($list1 as $val) { // foreach ($list1 as $val) {
foreach ($val as $net_data) { // foreach ($val as $net_data) {
fputcsv($file, $net_data); // fputcsv($file, $net_data);
fputcsv($all, $net_data); // fputcsv($all, $net_data);
} // }
} // }
} // }
//蘑菇服务器解析规则 //蘑菇服务器解析规则
@@ -957,6 +965,59 @@ function jiguang_getList($data, &$file, &$all )
} }
//极光服务器解析规则
function liebao_getList($data, &$file, &$all )
{
$key = '';
$list1 = [];
// print_r($data);
$province_record = [];
foreach ($data as $info) {
$record = [];
$record['name'] = '猎豹';
//如果存在 不为空 则
$city_name = explode('-',$info['city']);
if(empty($info['city'])) {
continue;
}
//如果存在 不为空 则
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'] = $info['ipCount'];
$record['daikuan'] = $info['daikuan'];
$record['onlineuser'] = '';
$record['maxuser'] = '';
$record['online'] = $info['status'];
$record['status'] = $info['onlinestatus'];
$record['nasname'] = $info['address'];
$list1[$key][] = $record;
}
foreach ($list1 as $val) {
foreach ($val as $net_data) {
fputcsv($file, $net_data);
fputcsv($all, $net_data);
}
}
}
//麒麟服务器解析规则 //麒麟服务器解析规则
function qilin_getList($data, &$file, &$all, $exit ) function qilin_getList($data, &$file, &$all, $exit )
{ {