From 5c30df9bcecf1c9f4c6a8402d32c9ec368b3b7a2 Mon Sep 17 00:00:00 2001 From: wanyongkang <937888580@qq.com> Date: Wed, 25 Nov 2020 19:51:39 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BA=BF=E8=B7=AF=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script/linedata/display.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/script/linedata/display.php b/script/linedata/display.php index 1dc3092..b974e62 100755 --- a/script/linedata/display.php +++ b/script/linedata/display.php @@ -4,8 +4,8 @@ * @version: * @Author: kangkang * @Date: 2020-11-06 14:32:57 - * @LastEditors: kangkang - * @LastEditTime: 2020-11-19 09:21:56 + * @LastEditors: Please set LastEditors + * @LastEditTime: 2020-11-25 19:50:43 */ header('Access-Control-Allow-Origin: *'); header("Access-Control-Allow-Methods: *"); @@ -114,7 +114,7 @@ function format_all_product($file_path) $data['status'] = $info[8]??''; if ($dns != 'shihui') { $ip = explode('.', ($info[9]??'')); - $data['nasname'] = $ip[0] ? ip_repeat($record, $ip[0]) . '.' . $dns : ''; + $data['nasname'] = $ip[0] ? ip_repeat($record, $ip[0],$dns) . '.' . $dns : ''; } else { $data['nasname'] = $info[9]??''; } @@ -262,18 +262,18 @@ function format_xingxing($file_path1, $file_path2, $dns) echo json_encode(['data' => $list, 'count' => $count, 'use_count' => $user_count]); } -function ip_repeat(&$record, $ip) +function ip_repeat(&$record, $ip, $dns ='') { for ($i = 2; $i < 100; $i++) { - if (in_array($ip, $record)) { - if (in_array($ip . 'v' . $i, $record)) { + if (in_array($ip.$dns, $record)) { + if (in_array($ip .$dns. 'v' . $i, $record)) { continue; } else { - $record[] = $ip . 'v' . $i; + $record[] = $ip .$dns. 'v' . $i; return $ip . 'v' . $i; } } else { - $record[] = $ip; + $record[] = $ip.$dns; return $ip; } }