client = new Client([ 'base_uri' => C('TASK_URL'), 'timeout' => 10.0, ]); } protected function post($uri, $data) { $response = $this->client->post($uri, [ 'verify' => false, 'form_params' => $data ]); $result = (string)$response->getBody(); return json_decode($result, true); } public function sendSms($mobile, $clientIp, $type = 'common') { return $this->post('/message/sms-send', ['mobile' => $mobile, 'type' => $type, 'client_ip' => $clientIp]); } public function checkSms($mobile, $code) { return $this->post('/message/sms-check', ['mobile' => $mobile, 'code' => $code]); } }