fix(sms): accept empty HTTP 200 responses

This commit is contained in:
2026-10-05 17:25:33 +08:00
parent 59e9bbf8a6
commit f00c3faeaa
2 changed files with 3 additions and 3 deletions
@@ -501,7 +501,7 @@ trait UserControllerAuthPhoneOperations {
}
$result = \AKSRT\Sms\SMS::get_instance()->test_send($phone);
return !empty($result['success'])
? $this->success(['message' => __('测试短信已发送', 'aksrt')])
? $this->success(['message' => (string) ($result['message'] ?? __('测试短信已发送', 'aksrt'))])
: $this->error((string) ($result['message'] ?? __('测试短信发送失败', 'aksrt')));
}
}
+2 -2
View File
@@ -52,8 +52,8 @@ class SMSProviderSmsbao implements ProviderInterface {
$body = trim((string) wp_remote_retrieve_body($response));
if ($body === '') {
return [
'success' => false,
'message' => sprintf(__('短信宝接口返回空响应(HTTP %d),请检查服务器到 api.smsbao.com 的 HTTPS 连接,并查看短信宝后台发送记录。', 'aksrt'), $status),
'success' => true,
'message' => sprintf(__('短信宝请求已提交(HTTP %d,响应正文为空)。', 'aksrt'), $status),
'transport' => 'smsbao_http',
];
}