$appId, 'timestamp' => $timestamp, 'mobiles' => $mobile, 'content' => $content, ]; $params['sign'] = md5($appId.$secret.$timestamp); Log::info('sms.gateway request', [ 'url' => $url, 'mobile_mask' => strlen($mobile) >= 11 ? substr($mobile, 0, 3).'****'.substr($mobile, -4) : '***', 'app_id_len' => strlen($appId), 'timestamp' => $timestamp, ]); try { $response = Http::timeout((int) config('sms.timeout', 5)) ->withHeaders(['Content-Type' => 'application/json']) ->get($url, $params); } catch (\Throwable $e) { Log::error('SMS request failed', ['exception' => $e->getMessage()]); return false; } $status = $response->status(); $bodySnippet = substr($response->body(), 0, 500); Log::info('sms.gateway response', [ 'http_status' => $status, 'body_preview' => $bodySnippet, ]); $return = $response->json(); if (! is_array($return)) { Log::error('SMS invalid JSON', ['body' => $response->body()]); return false; } if (($return['code'] ?? '') !== 'SUCCESS') { Log::warning('SMS gateway error', array_merge($return, ['http_status' => $status])); return false; } Log::info('sms.gateway success', [ 'mobile_mask' => strlen($mobile) >= 11 ? substr($mobile, 0, 3).'****'.substr($mobile, -4) : '***', ]); return true; } }