加上 web 的 season API

pull/19/head
david082321 3 years ago
parent 8655d389d0
commit f29406756d

@ -0,0 +1,45 @@
<?php
// 分类
$type = 2;
$cache_type = "web";
// 加载配置
include ($_SERVER['DOCUMENT_ROOT']."/config.php");
// 加载版本
include(ROOT_PATH."utils/version.php");
// 加载functions
include (ROOT_PATH."utils/functions.php");
if (SAVE_CACHE == 1) {
include (ROOT_PATH."utils/functions_cache.php");
}
// 处理用户传入参数
include (ROOT_PATH."utils/process.php");
// 设置host
$host = get_host($type,$cache_type);
// 锁区、web接口、X-From-Biliroaming
include (ROOT_PATH."utils/lock_area.php");
// 鉴权、替换access_key、获取缓存
// include (ROOT_PATH."utils/auth.php"); // 鉴权
if (SAVE_CACHE == 1) {
get_cache_season(); // 获取缓存
}
// 指定ip回源
if (IP_RESOLVE == 1) {
$host = $hosts[array_rand($hosts)];
$ip = $ips[array_rand($ips)];
}
// 转发到指定服务器
$url = $host.$path."?".$query;
if (IP_RESOLVE == 1) {
$output = get_webpage($url,$host,$ip);
} else {
$output = get_webpage($url);
}
// 替换内容
include (ROOT_PATH."utils/replace.php");
// 返回内容给用户
print($output);
// 写入缓存
if (SAVE_CACHE == 1) {
write_cache_season(); // 写入season
}
?>

@ -92,7 +92,26 @@ function get_host($type,$cache_type) {
break;
default:
$host = CUSTOM_HOST_DEFAULT_WEB_SEARCH;
}
}
}
break;
case 2: // season
if ($cache_type == "web"){
switch (AREA) {
case "cn":
$host = CUSTOM_HOST_CN;
break;
case "tw":
$host = CUSTOM_HOST_TW;
break;
case "hk":
$host = CUSTOM_HOST_HK;
break;
default:
$host = CUSTOM_HOST_DEFAULT;
}
} else {
$host = CUSTOM_HOST_TH;
}
break;
default:

Loading…
Cancel
Save