服务器列表
This commit is contained in:
83
script/linedata/display.php
Normal file → Executable file
83
script/linedata/display.php
Normal file → Executable file
@@ -5,7 +5,7 @@
|
||||
* @Author: kangkang
|
||||
* @Date: 2020-11-06 14:32:57
|
||||
* @LastEditors: kangkang
|
||||
* @LastEditTime: 2020-11-10 13:38:24
|
||||
* @LastEditTime: 2020-11-12 09:38:30
|
||||
*/
|
||||
header('Access-Control-Allow-Origin: *');
|
||||
header("Access-Control-Allow-Methods: *");
|
||||
@@ -17,7 +17,7 @@ switch($id){
|
||||
format_all_product(__DIR__.'/data/all.csv');
|
||||
break;
|
||||
case 8:
|
||||
format_xingxing(__DIR__.'/data/xingxing.csv','2288.csv','xxip.vip');
|
||||
format_xingxing(__DIR__.'/data/xingxing.csv',__DIR__.'/data/2288.csv','xxip.vip');
|
||||
break;
|
||||
case 6:
|
||||
format_product(__DIR__.'/data/xianfeng.csv','xfip.vip');
|
||||
@@ -55,6 +55,8 @@ function format_all_product($file_path){
|
||||
$list = [];
|
||||
$dns = '';
|
||||
$record = [];
|
||||
$user_count = 0;
|
||||
$count = 0;
|
||||
$file = fopen($file_path,'r');
|
||||
$file1 = fopen(__DIR__.'/data/download/all.csv','w');
|
||||
while ($info = fgetcsv($file)) {
|
||||
@@ -101,6 +103,10 @@ function format_all_product($file_path){
|
||||
$data['onlineuser'] = $info[5];
|
||||
$data['maxuser'] = $info[6];
|
||||
$data['online'] = $info[7];
|
||||
if(!empty($info[9])){
|
||||
$user_count += $data['online']=='正常'?1:0;
|
||||
$count++;
|
||||
}
|
||||
$data['status'] = $info[8];
|
||||
if($dns!='shihui'){
|
||||
$ip = explode('.',$info[9]);
|
||||
@@ -113,16 +119,26 @@ function format_all_product($file_path){
|
||||
}
|
||||
fclose($file);
|
||||
fclose($file1);
|
||||
echo json_encode(['data'=>$list]);
|
||||
echo json_encode(['data'=>$list,'count'=>$count,'use_count'=>$user_count]);
|
||||
}
|
||||
|
||||
function format_product($file_path,$dns = ''){
|
||||
$list1 = [];
|
||||
$list = [];
|
||||
$user_count = 0;
|
||||
$count = 0;
|
||||
$key = '';
|
||||
$file = fopen($file_path,'r');
|
||||
$file_path1 = explode('/',$file_path);
|
||||
$file1 = fopen(__DIR__.'/data/download/'.$file_path1[8],'w');
|
||||
$file1 = fopen(__DIR__.'/data/download/'.$file_path1[8],'w');
|
||||
$record = [];
|
||||
while ($info = fgetcsv($file)) {
|
||||
if(in_array($info['1'],['曾','龙'])){
|
||||
continue;
|
||||
}
|
||||
if(empty($info[9])){
|
||||
$key = $info[1];
|
||||
}
|
||||
$data['name'] = $info[0];
|
||||
$data['city'] = $info[1];
|
||||
$data['supply'] = $info[2];
|
||||
@@ -131,6 +147,10 @@ function format_product($file_path,$dns = ''){
|
||||
$data['onlineuser'] = $info[5];
|
||||
$data['maxuser'] = $info[6];
|
||||
$data['online'] = $info[7];
|
||||
if(!empty($info[9])){
|
||||
$user_count += $data['online']=='正常'?1:0;
|
||||
$count++;
|
||||
}
|
||||
$data['status'] = $info[8];
|
||||
if($dns!='shihui'){
|
||||
$ip = explode('.',$info[9]);
|
||||
@@ -139,23 +159,39 @@ function format_product($file_path,$dns = ''){
|
||||
$data['nasname'] = $info[9];
|
||||
}
|
||||
fputcsv($file1,$data);
|
||||
$list[] = $data;
|
||||
$list1[$key][] = $data;
|
||||
}
|
||||
|
||||
fclose($file1);
|
||||
fclose($file);
|
||||
echo json_encode(['data'=>$list]);
|
||||
foreach($list1 as $k=>$val){
|
||||
foreach($val as $net_data){
|
||||
|
||||
fputcsv($file3,$net_data);
|
||||
$list[] = $net_data;
|
||||
}
|
||||
}
|
||||
echo json_encode(['data'=>$list,'count'=>$count,'use_count'=>$user_count]);
|
||||
}
|
||||
|
||||
function format_xingxing($file_path1,$file_path2,$dns){
|
||||
$list1 = [];
|
||||
$list2 = [];
|
||||
$list = [];
|
||||
$user_count = 0;
|
||||
$count = 0;
|
||||
$key = '';
|
||||
$file1 = fopen($file_path1,'r');
|
||||
$file2 = fopen($file_path2,'r');
|
||||
$record = [];
|
||||
|
||||
$keys = [];
|
||||
$file_path = explode('/',$file_path1);
|
||||
$file3 = fopen(__DIR__.'/data/download/'.$file_path[8],'w');
|
||||
while ($info = fgetcsv($file1)) {
|
||||
if(empty($info[9])){
|
||||
$key = $info[1];
|
||||
$keys[] = $key;
|
||||
}
|
||||
$data['name'] = $info[0];
|
||||
$data['city'] = $info[1];
|
||||
$data['supply'] = $info[2];
|
||||
@@ -164,13 +200,22 @@ function format_xingxing($file_path1,$file_path2,$dns){
|
||||
$data['onlineuser'] = $info[5];
|
||||
$data['maxuser'] = $info[6];
|
||||
$data['online'] = $info[7];
|
||||
if(!empty($info[9])){
|
||||
$user_count += $data['online']=='正常'?1:0;
|
||||
$count++;
|
||||
}
|
||||
$data['status'] = $info[8];
|
||||
$ip = explode('.',$info[9]);
|
||||
$data['nasname'] = $ip[0]?ip_repeat($record,$ip[0]).'.'.$dns:'';
|
||||
fputcsv($file3,$data);
|
||||
$list1[] = $data;
|
||||
$list1[$key][] = $data;
|
||||
}
|
||||
while ($info = fgetcsv($file2)) {
|
||||
if(empty($info[9])){
|
||||
$key = $info[1];
|
||||
if(in_array($key,$keys)){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
$data['name'] = $info[0];
|
||||
$data['city'] = $info[1];
|
||||
$data['supply'] = $info[2];
|
||||
@@ -179,18 +224,30 @@ function format_xingxing($file_path1,$file_path2,$dns){
|
||||
$data['onlineuser'] = $info[5];
|
||||
$data['maxuser'] = $info[6];
|
||||
$data['online'] = $info[7];
|
||||
if(!empty($info[9])){
|
||||
$user_count += $data['online']=='正常'?1:0;
|
||||
$count++;
|
||||
}
|
||||
$data['status'] = $info[8];
|
||||
$ip = explode('.',$info[9]);
|
||||
$data['nasname'] = $ip[0]?ip_repeat($record,$ip[0]).'.'.$dns:'';
|
||||
fputcsv($file3,$data);
|
||||
$list2[] = $data;
|
||||
$list1[$key][] = $data;
|
||||
}
|
||||
|
||||
foreach($list1 as $k=>$val){
|
||||
foreach($val as $net_data){
|
||||
|
||||
fputcsv($file3,$net_data);
|
||||
$list[] = $net_data;
|
||||
}
|
||||
}
|
||||
|
||||
fclose($file1);
|
||||
fclose($file2);
|
||||
fclose($file3);
|
||||
$list = array_merge($list1,$list2);
|
||||
echo json_encode(['data'=>$list]);
|
||||
|
||||
|
||||
echo json_encode(['data'=>$list,'count'=>$count,'use_count'=>$user_count]);
|
||||
}
|
||||
|
||||
function ip_repeat(&$record,$ip){
|
||||
|
||||
Reference in New Issue
Block a user