basePath() . '/config' . ($path ? '/' . $path : $path); } } /** * @param $url 地址 * @param $param 参数 * @param bool $isCheck 是否检查返回结果 * @param string $method 请求方式 * @return array|mixed * @throws \GuzzleHttp\Exception\GuzzleException */ function http($url, $param, $isCheck = true, $method = 'post') { try { $client = new \GuzzleHttp\Client(); $response = $client->request($method, $url, $param); $result = json_decode($response->getBody()->getContents(), true); \Illuminate\Support\Facades\Log::debug('url:'.$url.'param:'.json_encode($param).'response:'.json_encode($result)); if ($isCheck == true) { return $result['data']; } else { return $result; } } catch (\Exception $exception) { return []; } }