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']); } } }