From f4f92569f8c1789eb4758bc714520dbf592c40f8 Mon Sep 17 00:00:00 2001 From: wanyongkang <937888580@qq.com> Date: Thu, 19 Nov 2020 09:25:33 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BA=BF=E8=B7=AF=E8=A1=A8=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script/linedata/display.php | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/script/linedata/display.php b/script/linedata/display.php index 2b093c5..1dc3092 100755 --- a/script/linedata/display.php +++ b/script/linedata/display.php @@ -5,7 +5,7 @@ * @Author: kangkang * @Date: 2020-11-06 14:32:57 * @LastEditors: kangkang - * @LastEditTime: 2020-11-18 15:33:34 + * @LastEditTime: 2020-11-19 09:21:56 */ header('Access-Control-Allow-Origin: *'); header("Access-Control-Allow-Methods: *"); @@ -111,12 +111,12 @@ function format_all_product($file_path) $user_count += $data['online'] == '正常' ? 1 : 0; $count++; } - $data['status'] = $info[8]; + $data['status'] = $info[8]??''; if ($dns != 'shihui') { - $ip = explode('.', $info[9]); + $ip = explode('.', ($info[9]??'')); $data['nasname'] = $ip[0] ? ip_repeat($record, $ip[0]) . '.' . $dns : ''; } else { - $data['nasname'] = $info[9]; + $data['nasname'] = $info[9]??''; } fputcsv($file1, $data); $list[] = $data; @@ -159,26 +159,25 @@ function format_product($file_path, $dns = '') $user_count += $data['online'] == '正常' ? 1 : 0; $count++; } - $data['status'] = $info[8]; + $data['status'] = $info[8]??''; if ($dns != 'shihui') { - $ip = explode('.', $info[9]); + $ip = explode('.', ($info[9]??'')); $data['nasname'] = $ip[0] ? ip_repeat($record, $ip[0]) . '.' . $dns : ''; } else { - $data['nasname'] = $info[9]; + $data['nasname'] = $info[9]??''; } - fputcsv($file1, $data); $list1[$key][] = $data; } - fclose($file1); - fclose($file); foreach ($list1 as $k => $val) { foreach ($val as $net_data) { - fputcsv($file3, $net_data); + fputcsv($file1, $net_data); $list[] = $net_data; } } + fclose($file1); + fclose($file); echo json_encode(['data' => $list, 'count' => $count, 'use_count' => $user_count]); } @@ -216,8 +215,8 @@ function format_xingxing($file_path1, $file_path2, $dns) $user_count += $data['online'] == '正常' ? 1 : 0; $count++; } - $data['status'] = $info[8]; - $ip = explode('.', $info[9]); + $data['status'] = $info[8]??''; + $ip = explode('.', ($info[9]??'')); $data['nasname'] = $ip[0] ? ip_repeat($record, $ip[0]) . '.' . $dns : ''; $list1[$key][] = $data; } @@ -242,8 +241,8 @@ function format_xingxing($file_path1, $file_path2, $dns) $user_count += $data['online'] == '正常' ? 1 : 0; $count++; } - $data['status'] = $info[8]; - $ip = explode('.', $info[9]); + $data['status'] = $info[8]??''; + $ip = explode('.', ($info[9]??'')); $data['nasname'] = $ip[0] ? ip_repeat($record, $ip[0]) . '.' . $dns : ''; $list1[$key][] = $data; } @@ -294,3 +293,4 @@ function city_exist($citys, $city) } } } +