Fixes for upgrade

This commit is contained in:
Aldarien
2023-02-10 15:14:14 +00:00
parent de6100a546
commit 87643a5b99
4 changed files with 19 additions and 12 deletions

View File

@ -39,17 +39,16 @@ function uf($date, $async = false) {
return (object) ['total' => 0];
}
$url = 'http://' . config('locations.money') . '/api/uf/value/' . $date->format('Y-m-d');
$client = new \Goutte\Client();
$client->setHeader('Accept', 'application/json');
$client->request('GET', $url);
$client = new \GuzzleHttp\Client(['base_uri' => 'http://' . config('locations.money') . '/', 'headers' => ['Accept' => 'application/json']]);
$response = $client->get('api/uf/value/' . $date->format('Y-m-d'));
$response = $client->getResponse();
//$response = $client->getResponse();
if (!$response) {
return (object) ['total' => 0];
}
$status = $response->getStatusCode();
if ($status >= 200 and $status < 300) {
$data = json_decode($response->getContent());
$data = json_decode($response->getBody()->getContents());
return $data;
}
return (object) ['total' => 0];