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
@@ -17,7 +17,7 @@ class PaymentService
{
$this->method = $method;
$this->class = '\\App\\Payments\\' . $this->method;
if (!class_exists($this->class)) throw new ApiException(500, 'gate is not found');
if (!class_exists($this->class)) throw new ApiException('gate is not found');
if ($id) $payment = Payment::find($id)->toArray();
if ($uuid) $payment = Payment::where('uuid', $uuid)->first()->toArray();
$this->config = [];
@@ -33,7 +33,7 @@ class PaymentService
public function notify($params)
{
if (!$this->config['enable']) throw new ApiException(500, 'gate is not enable');
if (!$this->config['enable']) throw new ApiException('gate is not enable');
return $this->payment->notify($params);
}