猎豹线路表

This commit is contained in:
“wanyongkang”
2023-12-29 15:59:14 +08:00
parent 2e55696e86
commit d47204bbf0

View File

@@ -5,7 +5,7 @@
* @Author: kangkang
* @Date: 2020-11-03 11:04:15
* @LastEditors: “wanyongkang” “937888580@qq.com”
* @LastEditTime: 2023-11-27 17:30:39
* @LastEditTime: 2023-12-28 17:26:52
*/
$is_script = 1;
include_once __DIR__ . '/../../index.php';
@@ -13,7 +13,9 @@ include_once __DIR__ . '/auto_format.php';
// // //测试用----------------------------------------------------------------------------------------------------------
// $tiantian = json_decode(file_get_contents("https://yoyoapi.yoyoip.com/v1/areas?apiid=89&sendtime=" . time() . "&sign=" . md5('apiid=89&sendtime=' . time() . 'NFeK72yYXmPiGR86YeMCBRTWDxXkrQsd')), true)['data'];
// $tiantian = json_decode(file_get_contents("https://xmapi.xingmojs.com/ppp/v1/areas?apiid=130&sendtime=" . time() . "&sign=" . md5('apiid=130&sendtime=' . time() . '3AT7XCHjWG8sSMpRBjtAJ8JRkSAbhJit')), true);
// dump($tiantian);
// die;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -175,6 +177,18 @@ tiantian_getList($tiantian, $tiantian_f, $all, $tiantian_data, '天天');
fclose($tiantian_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);
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);
}
@@ -674,6 +688,59 @@ function tiantian_getList($data, &$file, &$all, $exit, $product_name)
}
//天天服务器解析规则
function liebao_getList($data, &$file, &$all, $exit, $product_name)
{
global $dnx_exit, $dnx_has_exit;
$status = ['故障', '正常'];
$key = '';
$list1 = [];
foreach ($data as $info) {
$record = [];
$record['name'] = $product_name;
$record['city'] = $info['name'];
$key = $record['city'];
$list1[$key][] = $record;
foreach ($info['areas'] as $v) {
if (strpos($v['name'], '电信') !== false) {
$record['city'] = $v['name'];
$record['supply'] = '电信';
} elseif (strpos($v['name'], '联通') !== false) {
$record['city'] = $v['name'];
$record['supply'] = '联通';
} elseif (strpos($v['name'], '移动') !== false) {
$record['city'] = $v['name'];
$record['supply'] = '移动';
} else {
$record['city'] = $v['name'];
$record['supply'] = '电信/联通';
}
$record['ip'] = '';
$record['daikuan'] = '';
$record['onlineuser'] = '';
$record['maxuser'] = '';
$record['online'] = empty($v['status']) ? '故障' : $status[$v['status']];
$record['status'] = '';
$record['nasname'] = $v['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) {
fputcsv($file, $net_data);
fputcsv($all, $net_data);
}
}
}
//蘑菇服务器解析规则
function mogu_getList($data, &$file, &$all )