fix(sms): accept empty HTTP 200 responses
This commit is contained in:
@@ -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')));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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',
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user