强子静态

This commit is contained in:
“wanyongkang”
2023-05-14 17:35:11 +08:00
parent 1e6e3eb509
commit 57fbe214b9
4 changed files with 148 additions and 16 deletions

View File

@@ -1,7 +1,7 @@
<?php
function auto_format_list(){
$product_list = [0, 1, 2, 4, 5, 6, 8, 10, 13, 14, 15, 16, 17, 18, 19,22,23];
$product_list = [0, 1, 2, 4, 5, 6, 8, 10, 13, 14, 15, 16, 17, 18, 19,22,23,25];
foreach ($product_list as $product) {
switch ($product) {
case 0:
@@ -55,6 +55,9 @@ function auto_format_list(){
case 23:
format_product(__DIR__ . '/data/yunniu.csv','ynip.net');
break;
case 25:
format_product(__DIR__ . '/data/qiangzijt.csv','qzip.vip');
break;
}
}
}
@@ -118,6 +121,10 @@ function format_all_product($file_path)
case '云牛':
$dns = 'ynip.net';
break;
case '强子静态':
$dns = 'qzip.vip';
break;
default:
$dns = 'xlip.vip';
break;

View File

@@ -4,8 +4,8 @@
* @version:
* @Author: kangkang
* @Date: 2020-11-06 14:32:57
* @LastEditors: Please set LastEditors
* @LastEditTime: 2022-04-28 17:58:19
* @LastEditors: “wanyongkang” “937888580@qq.com”
* @LastEditTime: 2023-05-14 17:23:48
*/
header('Access-Control-Allow-Origin: *');
header("Access-Control-Allow-Methods: *");
@@ -66,6 +66,10 @@ switch ($id) {
case 23:
get_product(__DIR__ . '/data/download/yunniu.csv');
break;
case 25:
get_product(__DIR__ . '/data/download/qiangzijt.csv');
break;
}
function get_all_product($file_path)

View File

@@ -5,7 +5,7 @@
* @Author: kangkang
* @Date: 2020-11-03 11:04:15
* @LastEditors: “wanyongkang” “937888580@qq.com”
* @LastEditTime: 2023-04-24 23:53:47
* @LastEditTime: 2023-05-14 17:22:37
*/
$is_script = 1;
include_once __DIR__ . '/../../index.php';
@@ -14,18 +14,23 @@ include_once __DIR__ . '/auto_format.php';
// //测试用----------------------------------------------------------------------------------------------------------
// $url = 'http://int.linghangsoft.net:8000/sysadmin/useradmin/lineapi_admin1.php?secretId=108006113&secretKey=87085a351a64c116df09ebc07d5781sf';
// $yunniu = json_decode(file_get_contents($url), true);
// $time = time();
// $noce = md5(time());
// $apikey = 'a478ad5aa3079bbbef3cd45e2d55d61e';
// $sign = md5($time.$noce.$apikey);
// $url = "http://47.92.116.14:2222/api/getNodeList?agentid=admin1&ti=".$time."&nonce=".$noce."&sign=".$sign;
// $qiangzi = json_decode(file_get_contents($url), true)['data'];
// dump($qiangzi);
// if(!empty($yunniu)){
// $yunniu_f = fopen(__DIR__ . '/data/yunniu.csv', 'w');
// //写入火狐文件
// $yunniu_data = get_product(__DIR__ . '/data/yunniu.csv');
// huohu_getList($yunniu, $yunniu_f, $all,$yunniu_data);
// fclose($yunniu_f);
// if(!empty($qiangzi)){
// $qiangzi_data = get_product(__DIR__ . '/data/qiangzijt.csv');
// $qiangzi_f = fopen(__DIR__ . '/data/qiangzijt.csv', 'w');
// //写入强子文件
// qiangzijt_getList($qiangzi, $qiangzi_f, $all, $qiangzi_data);
// fclose($qiangzi_f);
// }
// die;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//强子迅联特征码
@@ -81,6 +86,23 @@ $qiangzi_f = fopen(__DIR__ . '/data/qiangzi.csv', 'w');
qiangzi_getList($qiangzi, $qiangzi_f, $all, $qiangzi_data);
fclose($qiangzi_f);
}
// 静态
$time = time();
$noce = md5(time());
$apikey = 'a478ad5aa3079bbbef3cd45e2d55d61e';
$sign = md5($time.$noce.$apikey);
$url = "http://47.92.116.14:2222/api/getNodeList?agentid=admin1&ti=".$time."&nonce=".$noce."&sign=".$sign;
$qiangzi = json_decode(file_get_contents($url), true)['data'];
if(!empty($qiangzi)){
$qiangzi_data = get_product(__DIR__ . '/data/qiangzijt.csv');
$qiangzi_f = fopen(__DIR__ . '/data/qiangzijt.csv', 'w');
//写入强子文件
qiangzijt_getList($qiangzi, $qiangzi_f, $all, $qiangzi_data);
fclose($qiangzi_f);
}
@@ -214,6 +236,9 @@ function qiangzi_getList($data, &$file, &$all, $exit)
foreach ($data as $info) {
$record = [];
$record['name'] = '强子';
if ($info['areaname'] == '静态线路') {
continue;
}
//如果存在 不为空 则
$city_name = explode('-',$info['name']);
if (strpos($city_name[1], '混播') !== false) {
@@ -284,6 +309,95 @@ function qiangzi_getList($data, &$file, &$all, $exit)
}
//强子静态服务器解析规则
function qiangzijt_getList($data, &$file, &$all, $exit)
{
global $dnx_exit, $dnx_has_exit,$sp_qz_list;
$online = ['故障', '正常', '紧张','繁忙'];
$status = ['正常', '拥挤', '超载'];
$key = '';
$list1 = [];
$province_record = [];
foreach ($data as $info) {
$record = [];
$record['name'] = '强子静态';
if ($info['areaname'] != '静态线路') {
continue;
}
//如果存在 不为空 则
$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[1], $province_record)) {
$record['city'] = $city_name[1];
$province_record[] = $city_name[1];
$key = $record['city'];
$list1[$key][] = $record;
}
$key = $city_name[1];
}
$record['city'] = $city_name[2];
$record['supply'] = isset($city_name[2]) ? $city_name[2] : '';
$daikuan = $info['bandwidth'];
$record['ip'] = $info['name2'];
$record['daikuan'] = $daikuan;
$record['onlineuser'] = '';
$record['maxuser'] = '';
$record['online'] = $online[$info['status']];
$record['status'] = $sp_qz_list[$record['city']];
if(!empty($info['host2'])){
$nas_list = explode(',',$info['host2']);
foreach ($nas_list as $nas) {
$record['nasname'] = trim($nas);
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;
}
}
$record['nasname'] = trim($info['host']);
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 huohu_getList($data, &$file, &$all, $exit)
{

View File

@@ -4,8 +4,8 @@
* @version:
* @Author: kangkang
* @Date: 2020-11-07 11:13:08
* @LastEditors: Please set LastEditors
* @LastEditTime: 2022-04-28 17:38:25
* @LastEditors: “wanyongkang” “937888580@qq.com”
* @LastEditTime: 2023-05-14 17:33:46
*/
header('Access-Control-Allow-Origin: *');
header("Access-Control-Allow-Methods: *");
@@ -69,6 +69,9 @@ if($_GET['type'] == 1){
case 23:
search_product(__DIR__ . '/data/download/yunniu.csv','ynip.net');
break;
case 25:
search_product(__DIR__ . '/data/download/qiangzijt.csv','qzip.vip');
break;
}
}
@@ -140,6 +143,10 @@ function search_all_product($file_path,$search){
case '云牛':
$dns = 'ynip.net';
break;
case '强子静态':
$dns = 'qzip.vip';
break;
}
$data['city'] = $info[1];