diff --git a/db/allTlds.db b/db/allTlds.db deleted file mode 100644 index 510ac62..0000000 Binary files a/db/allTlds.db and /dev/null differ diff --git a/db/icpTlds.db b/db/icpTlds.db deleted file mode 100644 index 591deee..0000000 Binary files a/db/icpTlds.db and /dev/null differ diff --git a/db/tldInfo.db b/db/tldInfo.db new file mode 100644 index 0000000..109b269 Binary files /dev/null and b/db/tldInfo.db differ diff --git a/functions/ExtractDomain.php b/functions/ExtractDomain.php index 87d3e85..cbcacae 100644 --- a/functions/ExtractDomain.php +++ b/functions/ExtractDomain.php @@ -1,29 +1,13 @@ tldDB); - $res = $db->query('SELECT tld FROM `tlds`;'); + $res = $db->query('SELECT record FROM `list`;'); while ($row = $res->fetchArray(SQLITE3_ASSOC)) { - $tlds[] = $row['tld']; - } - $tlds = array_merge($tlds, $this->getIcpTlds()); - $tlds = array_unique($tlds); - foreach ($tlds as $tld) { - echo $tld . PHP_EOL; - } - return $tlds; // Unicode字符使用Punycode编码 - } - - private function getIcpTlds() { // 获取所有可ICP备案的顶级域 - $db = new SqliteDB($this->icpDB); - $punycode = new Punycode(); - $res = $db->query('SELECT tld FROM `tlds`;'); - while ($row = $res->fetchArray(SQLITE3_ASSOC)) { - $tlds[] = $punycode->encode($row['tld']); // 转为Punycode编码 + $tlds[] = $row['record']; } return $tlds; // Unicode字符使用Punycode编码 } diff --git a/functions/Punycode.php b/functions/Punycode.php index eb2bc63..ccdf623 100644 --- a/functions/Punycode.php +++ b/functions/Punycode.php @@ -359,3 +359,5 @@ class Punycode { } } } + +?> diff --git a/functions/RedisCache.php b/functions/RedisCache.php index a7c6e27..8c1e29c 100644 --- a/functions/RedisCache.php +++ b/functions/RedisCache.php @@ -1,9 +1,9 @@ redisSetting = array( 'host' => $env['REDIS_HOST'], @@ -32,7 +32,7 @@ class redisCache { } $redisKey = $this->redisSetting['prefix'] . $key; $status = $redis->set($redisKey, $data); // 写入数据库 - $redis->pexpire($redisKey, $cacheTTL * 1000); // 设置过期时间 单位ms + $redis->pexpire($redisKey, $cacheTTL * 1000); // 设置过期时间 单位 ms = s * 1000 return $status; } } diff --git a/functions/TgInterface.php b/functions/TgInterface.php index fa2353e..f91ad72 100644 --- a/functions/TgInterface.php +++ b/functions/TgInterface.php @@ -49,7 +49,7 @@ class tgApi { return file_get_contents($url); } - function debugDump() { // 调试接口 + function debug() { // 调试接口 global $webhook, $tgEnv; $msg .= 'isCallback: ' . ($tgEnv['isCallback'] ? 'true' : 'false') . PHP_EOL; $msg .= 'isGroup: ' . ($tgEnv['isGroup'] ? 'true' : 'false') . PHP_EOL; diff --git a/models/icpQuery.php b/models/icpQuery.php index 34666fc..228b18e 100644 --- a/models/icpQuery.php +++ b/models/icpQuery.php @@ -64,9 +64,9 @@ class icpQuery { class icpQueryEntry { private function getIcpTlds() { // 获取所有可ICP备案的顶级域 - $db = new icpDB; + $db = new SqliteDB('./db/tldInfo.db'); $punycode = new Punycode(); - $res = $db->query('SELECT tld FROM `tlds`;'); + $res = $db->query('SELECT tld FROM `icp`;'); while ($row = $res->fetchArray(SQLITE3_ASSOC)) { $tlds[] = $punycode->encode($row['tld']); // 转为Punycode编码 }