refactor: 规范状态码、抛出异常的使用

This commit is contained in:
xboard
2023-12-07 04:01:32 +08:00
parent c25803aa74
commit 189b247ad8
71 changed files with 663 additions and 910 deletions
+2 -2
View File
@@ -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;
}