fix: 优化阿里云失败结果和操作显示

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
kate522andClaude Fable 5 committed 2026-08-01 22:44:45 +08:00
1 parent 591902f680
commit 4332518c22
2 files changed
+9 -4

No files matched your search

+4 -2
View File
@@ -86,10 +86,12 @@
if (stageNode) stageNode.textContent = data.stage || data.status || '认证处理中'; if (stageNode) stageNode.textContent = data.stage || data.status || '认证处理中';
if (messageNode) messageNode.textContent = data.message || '认证结果以站点服务端主动查询为准。'; if (messageNode) messageNode.textContent = data.message || '认证结果以站点服务端主动查询为准。';
if (continueLink) { if (continueLink) {
continueLink.hidden = !data.redirect_url; var canContinue = data.next_action === 'poll' && data.redirect_url;
if (data.redirect_url) continueLink.href = data.redirect_url; continueLink.hidden = !canContinue;
if (canContinue) continueLink.href = data.redirect_url;
} }
if (manualButton) manualButton.hidden = data.next_action !== 'manual_or_retry'; if (manualButton) manualButton.hidden = data.next_action !== 'manual_or_retry';
if (data.next_action === 'manual_or_retry' && manualForm) manualForm.hidden = true;
shouldPoll = data.next_action === 'poll'; shouldPoll = data.next_action === 'poll';
if (data.status === 'verified') { if (data.status === 'verified') {
shouldPoll = false; shouldPoll = false;
@@ -95,6 +95,10 @@ final class AliyunProvider implements ProviderInterface {
return ProviderResult::passed(['request_id' => (string) ($response['RequestId'] ?? ''), 'result_code' => 'passed']); return ProviderResult::passed(['request_id' => (string) ($response['RequestId'] ?? ''), 'result_code' => 'passed']);
} }
$status = strtoupper((string) ($object['SubCode'] ?? $object['Status'] ?? $object['subCode'] ?? $object['status'] ?? '')); $status = strtoupper((string) ($object['SubCode'] ?? $object['Status'] ?? $object['subCode'] ?? $object['status'] ?? ''));
$message = $object['MaterialInfo'] ?? $object['Message'] ?? $object['message'] ?? __('阿里云仍在处理认证结果', 'aksrt');
if ($passed === 'F') {
return ProviderResult::failed($status ?: 'not_passed', sanitize_text_field((string) $message));
}
if ($object === []) { if ($object === []) {
$debug = $this->response_debug_summary($response, $object); $debug = $this->response_debug_summary($response, $object);
$this->log_debug('DescribeFaceVerify empty ResultObject', $debug); $this->log_debug('DescribeFaceVerify empty ResultObject', $debug);
@@ -105,10 +109,9 @@ final class AliyunProvider implements ProviderInterface {
]); ]);
} }
if ($status === '' || in_array($status, ['PROCESSING', 'INIT', 'PENDING'], true)) { if ($status === '' || in_array($status, ['PROCESSING', 'INIT', 'PENDING'], true)) {
$message = $object['MaterialInfo'] ?? $object['Message'] ?? $object['message'] ?? __('阿里云仍在处理认证结果', 'aksrt');
return ProviderResult::pending(['result_code' => $status ?: 'processing', 'message' => sanitize_text_field((string) $message)]); return ProviderResult::pending(['result_code' => $status ?: 'processing', 'message' => sanitize_text_field((string) $message)]);
} }
return ProviderResult::failed($status, sanitize_text_field((string) ($object['MaterialInfo'] ?? $object['Message'] ?? $object['message'] ?? __('实人认证未通过', 'aksrt')))); return ProviderResult::failed($status, sanitize_text_field((string) $message));
} }
private function is_public_https_url(string $url): bool { private function is_public_https_url(string $url): bool {