mirror of
https://github.com/lkddi/Xboard.git
synced 2026-04-24 03:57:27 +08:00
refactor: 规范状态码、抛出异常的使用
This commit is contained in:
@@ -60,9 +60,9 @@ class TelegramService {
|
||||
$curl->get($this->api . $method . '?' . http_build_query($params));
|
||||
$response = $curl->response;
|
||||
$curl->close();
|
||||
if (!isset($response->ok)) throw new ApiException(500, '请求失败');
|
||||
if (!isset($response->ok)) throw new ApiException('请求失败');
|
||||
if (!$response->ok) {
|
||||
throw new ApiException(500, '来自TG的错误:' . $response->description);
|
||||
throw new ApiException('来自TG的错误:' . $response->description);
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user