修复日志页面卡顿我呢提
This commit is contained in:
@@ -3,6 +3,8 @@ require_once __DIR__ . '/../Page/FpPageRenderer.php';
|
||||
require_once __DIR__ . '/../Page/RiskPageRenderer.php';
|
||||
require_once __DIR__ . '/../FpUrlHelper.php';
|
||||
require_once __DIR__ . '/../RiskSecondaryGate.php';
|
||||
require_once __DIR__ . '/../RiskSecondaryCache.php';
|
||||
require_once __DIR__ . '/../ClientIpResolver.php';
|
||||
|
||||
/**
|
||||
* 判定完成后的路由输出(真实页 / 安全页 / 二次风控)
|
||||
@@ -78,6 +80,15 @@ class RouteResolver
|
||||
if (!isset($_SESSION['visit_to_3'])) {
|
||||
$_SESSION['visit_to_3'] = '1';
|
||||
}
|
||||
|
||||
if (RiskSecondaryGate::isEnabled()) {
|
||||
$cached = RiskSecondaryCache::get(ClientIpResolver::resolve());
|
||||
if ($cached !== null) {
|
||||
self::renderFromRiskCache($logs, $v_info, $cached);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (($_SESSION['visit_to_3'] ?? '1') != '3'
|
||||
&& RiskSecondaryGate::isEnabled()) {
|
||||
// 二次风控:先写 wait 状态,f_check 完成后再更新 result / fp_url(避免 true+空跳转)
|
||||
@@ -103,6 +114,34 @@ class RouteResolver
|
||||
FpPageRenderer::render(['logs' => $logs]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 二次风控 Session 缓存命中:跳过 cloakjs / byApiRisk。
|
||||
*
|
||||
* @param array $logs
|
||||
* @param array $cached
|
||||
*/
|
||||
private static function renderFromRiskCache(array $logs, $v_info, array $cached)
|
||||
{
|
||||
RiskSecondaryCache::applyToSession($cached);
|
||||
$apiResponse = RiskSecondaryCache::toApiResponse($cached);
|
||||
|
||||
$logs['result'] = $apiResponse['result'] ? 'true' : 'false';
|
||||
$logs['reason'] = $apiResponse['reason'];
|
||||
$logs['fp_url'] = trim((string) ($apiResponse['link'] ?? ''));
|
||||
if ($logs['fp_url'] === '') {
|
||||
$logs['fp_url'] = $logs['result'] === 'true'
|
||||
? FpUrlHelper::fallbackUrl()
|
||||
: (defined('DB_ZP') ? (string) DB_ZP : '');
|
||||
}
|
||||
|
||||
if ($logs['result'] === 'false') {
|
||||
self::renderSafePage($logs, $v_info);
|
||||
return;
|
||||
}
|
||||
|
||||
FpPageRenderer::render(['logs' => $logs]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $ctx 需含 v_info, log_id
|
||||
*/
|
||||
|
||||
Regular → Executable
+4
-1
@@ -35,7 +35,10 @@ if (!CountryAllowlist::isAllowed($countryCode, $allowlist)) {
|
||||
if ($countryCode === null || $countryCode === '') {
|
||||
$reason = '无法识别访客国家';
|
||||
} else {
|
||||
$reason = '国家不符:' . $countryCode;
|
||||
$reason = '国家不符:访客 ' . $countryCode;
|
||||
if ($allowlist !== []) {
|
||||
$reason .= ',允许 ' . implode(',', $allowlist);
|
||||
}
|
||||
}
|
||||
if (!empty($GLOBALS['__cloak_debug_on'])) {
|
||||
cloak_dbg_step(__LINE__, 'GeoIP国家判定', 'fail', $reason, [
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
<?php
|
||||
//判断临时链接参数(Guard 之后、API/指纹 之前)
|
||||
if (!empty($GLOBALS['__cloak_simulation_on'])) {
|
||||
return;
|
||||
}
|
||||
if(empty($_SESSION["check_result"]) && !$whiteParamsMatched && SHOW_SITE_MODE_SWITCH == 'ip_check' && CLOAK_URL_ARGS_TIMEOUT > 0) {
|
||||
if ($__cloak_debug_on) {
|
||||
cloak_dbg_step(__LINE__,'临时链接参数', 'info', 'CLOAK_URL_ARGS_TIMEOUT=' . CLOAK_URL_ARGS_TIMEOUT . ' 分钟,开始检查');
|
||||
|
||||
@@ -97,6 +97,8 @@
|
||||
cloak_dbg_step(__LINE__, 'JS 指纹检测', 'skip', 'DEBUG 跳过指纹 JS 跳转,直接进入 API 判定');
|
||||
CloakDebugPage::setFlag('skipped_fingerprint', true);
|
||||
$v_info->check_result = 'true';
|
||||
} elseif (!empty($GLOBALS['__cloak_simulation_on'])) {
|
||||
$v_info->check_result = 'true';
|
||||
} else {
|
||||
FingerprintRedirectRenderer::renderAndExit($config_name);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user