fix(sms): accept empty HTTP 200 responses
This commit is contained in:
1 parent
59e9bbf8a6
commit
f00c3faeaa
2 files changed
+3
-3
No files matched your search
@@ -501,7 +501,7 @@ trait UserControllerAuthPhoneOperations {
|
|||||||
}
|
}
|
||||||
$result = \AKSRT\Sms\SMS::get_instance()->test_send($phone);
|
$result = \AKSRT\Sms\SMS::get_instance()->test_send($phone);
|
||||||
return !empty($result['success'])
|
return !empty($result['success'])
|
||||||
? $this->success(['message' => __('测试短信已发送', 'aksrt')])
|
? $this->success(['message' => (string) ($result['message'] ?? __('测试短信已发送', 'aksrt'))])
|
||||||
: $this->error((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));
|
$body = trim((string) wp_remote_retrieve_body($response));
|
||||||
if ($body === '') {
|
if ($body === '') {
|
||||||
return [
|
return [
|
||||||
'success' => false,
|
'success' => true,
|
||||||
'message' => sprintf(__('短信宝接口返回空响应(HTTP %d),请检查服务器到 api.smsbao.com 的 HTTPS 连接,并查看短信宝后台发送记录。', 'aksrt'), $status),
|
'message' => sprintf(__('短信宝请求已提交(HTTP %d,响应正文为空)。', 'aksrt'), $status),
|
||||||
'transport' => 'smsbao_http',
|
'transport' => 'smsbao_http',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user