A2C工单修复
This commit is contained in:
@@ -47,16 +47,18 @@ class AntiBotConfigBuilder
|
||||
'sessionTtlMinutes' => $ttlMinutes,
|
||||
'businessHostHint' => $businessHostHint,
|
||||
'landingUrlHint' => $landingUrlHint !== '' ? $landingUrlHint : '',
|
||||
'cfCloudflareSolver' => self::defaultCfCloudflareSolver($ticketType),
|
||||
'cfChallengeMode' => self::defaultCfChallengeMode($ticketType),
|
||||
] + self::postCfReadyExtras($ticketType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 会话 scope:A2C 短链固定业务域;火箭长链用动态 host、短链用 share.{token}
|
||||
* 会话 scope:A2C 业务域+分享 id;火箭长链用动态 host、短链用 share.{token}
|
||||
*/
|
||||
public static function resolveSessionScope(string $ticketType, string $pageUrl, string $landingUrlHint = ''): string
|
||||
{
|
||||
if ($ticketType === 'a2c') {
|
||||
return self::resolveA2cSessionHost($pageUrl, $landingUrlHint);
|
||||
return self::resolveA2cSessionScope($pageUrl, $landingUrlHint);
|
||||
}
|
||||
|
||||
if ($ticketType === 'huojian') {
|
||||
@@ -135,10 +137,11 @@ class AntiBotConfigBuilder
|
||||
if ($ticketType === 'a2c') {
|
||||
return [
|
||||
'postCfReadyUrlContains' => '/visitors/counter/share',
|
||||
'postCfReadySelector' => '.btn-next',
|
||||
'postCfReadyTimeoutMs' => 30000,
|
||||
'postCfReadySelector' => '.el-table',
|
||||
'postCfReadyApiUrl' => '/api/talk/counter/share/record/list',
|
||||
'postCfReadyTimeoutMs' => 60000,
|
||||
'postCfSettleMs' => 500,
|
||||
'postCfSpaWaitMs' => 4000,
|
||||
'postCfSpaWaitMs' => 8000,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -162,10 +165,6 @@ class AntiBotConfigBuilder
|
||||
|
||||
private static function defaultSolverFallback(string $ticketType): bool
|
||||
{
|
||||
if ($ticketType === 'a2c') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -178,6 +177,26 @@ class AntiBotConfigBuilder
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* A2C 等为 CF Managed Challenge(5s 盾),非独立 Turnstile 挂件
|
||||
*/
|
||||
private static function defaultCfChallengeMode(string $ticketType): string
|
||||
{
|
||||
if ($ticketType === 'a2c') {
|
||||
return 'managed';
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* sitekey 缺失时是否允许 CapSolver AntiCloudflareTask(需 Node 侧 CAPTCHA_PROXY)
|
||||
*/
|
||||
private static function defaultCfCloudflareSolver(string $ticketType): bool
|
||||
{
|
||||
return $ticketType === 'a2c';
|
||||
}
|
||||
|
||||
/**
|
||||
* 火箭/A2C 业务域 hint:优先长链动态 host,其次 landing 预解析
|
||||
*/
|
||||
@@ -223,6 +242,35 @@ class AntiBotConfigBuilder
|
||||
return 'user.a2c.chat';
|
||||
}
|
||||
|
||||
/**
|
||||
* A2C 会话 scope:业务域 + 分享 id(避免多工单共用温池 Browser 互相干扰)
|
||||
*/
|
||||
private static function resolveA2cSessionScope(string $pageUrl, string $landingUrlHint = ''): string
|
||||
{
|
||||
$host = self::resolveA2cSessionHost($pageUrl, $landingUrlHint);
|
||||
$shareId = self::extractA2cShareId($pageUrl);
|
||||
if ($shareId === '' && $landingUrlHint !== '') {
|
||||
$shareId = self::extractA2cShareId($landingUrlHint);
|
||||
}
|
||||
|
||||
return $shareId !== '' ? $host . ':' . $shareId : $host;
|
||||
}
|
||||
|
||||
/**
|
||||
* 从 A2C 分享 URL 提取 id 查询参数
|
||||
*/
|
||||
private static function extractA2cShareId(string $url): string
|
||||
{
|
||||
$query = (string) parse_url($url, PHP_URL_QUERY);
|
||||
if ($query === '') {
|
||||
return '';
|
||||
}
|
||||
parse_str($query, $params);
|
||||
$id = isset($params['id']) ? trim((string) $params['id']) : '';
|
||||
|
||||
return $id !== '' ? $id : '';
|
||||
}
|
||||
|
||||
private static function resolveHuojianSessionScope(string $pageUrl, string $landingUrlHint = ''): string
|
||||
{
|
||||
$scope = HuojianUrlHelper::resolveSessionScope($pageUrl);
|
||||
|
||||
Reference in New Issue
Block a user