From de52536a3725cea3853f6bd6e0978801fc88f41f Mon Sep 17 00:00:00 2001 From: lingling <1077478963@qq.com> Date: Sun, 9 Mar 2025 12:37:13 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=AE=BE=E7=BD=AE=20SendCode=20?= =?UTF-8?q?=E7=B1=BB=E7=9A=84=E8=AF=B7=E6=B1=82=E8=B6=85=E6=97=B6=E6=97=B6?= =?UTF-8?q?=E9=97=B4=EF=BC=8C=E4=BC=98=E5=8C=96=20API=20=E8=B0=83=E7=94=A8?= =?UTF-8?q?=E7=A8=B3=E5=AE=9A=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Utils/API/SendCode.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/Utils/API/SendCode.php b/app/Utils/API/SendCode.php index b7512d3..7f0ce4a 100644 --- a/app/Utils/API/SendCode.php +++ b/app/Utils/API/SendCode.php @@ -24,6 +24,8 @@ class SendCode { if (self::$client == null) { self::$client = new Client([ + 'timeout' => 60, // 设置请求超时时间为60秒 + 'connect_timeout' => 30, // 设置连接超时时间为30秒 'curl' => [ CURLOPT_FRESH_CONNECT => false, CURLOPT_FORBID_REUSE => false, @@ -96,7 +98,7 @@ class SendCode $client = self::get_client(); - $url = "https://dx1.rocketgo.vip/ex-api/biz/api/wsStatus?wsNumber=" . $phone . "&token=".self::$token; + $url = "https://dx1.rocketgo.vip/ex-api/biz/api/wsStatus?wsNumber=" . $phone . "&token=" . self::$token; // 发送 POST 请求 $response = $client->get("$url"); $body = $response->getBody(); @@ -104,11 +106,11 @@ class SendCode if ($responseData['code'] == 0) { return $responseData['status']; } - if($responseData['code'] == 1){ + if ($responseData['code'] == 1) { // Log::warning("号商api token无效"); return 2; } - if($responseData['code'] == 2){ + if ($responseData['code'] == 2) { // Log::warning("ws 在第三方api不存在 ws号".$phone); return 3; } @@ -138,7 +140,7 @@ class SendCode $body = $response->getBody(); $responseData = json_decode($body, true); // 如果返回的是 JSON 格式,解析它 if ($responseData['code'] != 0) { - Log::warning("ws:".$phone."删除失败 Code:".$responseData['code']); + Log::warning("ws:" . $phone . "删除失败 Code:" . $responseData['code'].' msg:'.$responseData['msg']); } } }