新增json支持的站点列表本地化

This commit is contained in:
iyuu.cn
2020-01-21 11:00:28 +08:00
parent 36d07a25db
commit ad6f798946
3 changed files with 137 additions and 0 deletions

View File

@ -90,6 +90,7 @@ class AutoReseed
*/
public static function init()
{
// 显示支持站点列表
self::ShowTableSites();
global $configALL;
self::$clients = isset($configALL['default']['clients']) && $configALL['default']['clients'] ? $configALL['default']['clients'] : array();
@ -123,6 +124,16 @@ class AutoReseed
$curl->setOpt(CURLOPT_SSL_VERIFYHOST, false); // 不检查证书
$res = $curl->post(self::$apiUrl);
$sites = json_decode($res->response, true);
// 数据写入本地
if (true) {
$json = array_column($sites, null, 'site');
ksort($json);
$json = json_encode($json, JSON_UNESCAPED_UNICODE);
$myfile = ROOT_PATH.DS.'config'.DS.'sites.json';
$file_pointer = @fopen($myfile,"w");
$worldsnum = @fwrite($file_pointer,$json);
@fclose($file_pointer);
}
$data = [];
$i = $j = $k = 0;
foreach($sites as $v)