Money and Remote services
This commit is contained in:
@ -31,27 +31,13 @@ function route_api() {
|
||||
return call_user_func_array([$class, $a], $params);
|
||||
}
|
||||
function uf($date, $async = false) {
|
||||
if (is_string($date)) {
|
||||
$date = Carbon\Carbon::parse($date, config('app.timezone'));
|
||||
}
|
||||
$next_m_9 = Carbon\Carbon::today(config('app.timezone'))->copy()->endOfMonth()->addDays(9);
|
||||
if ($date->greaterThanOrEqualTo($next_m_9)) {
|
||||
return (object) ['total' => 0];
|
||||
}
|
||||
$url = 'http://' . config('locations.money') . '/api/uf/value/' . $date->format('Y-m-d');
|
||||
$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();
|
||||
if (!$response) {
|
||||
return (object) ['total' => 0];
|
||||
}
|
||||
$status = $response->getStatusCode();
|
||||
if ($status >= 200 and $status < 300) {
|
||||
$data = json_decode($response->getBody()->getContents());
|
||||
return $data;
|
||||
}
|
||||
return (object) ['total' => 0];
|
||||
$remote = new App\Service\Remote(new App\Alias\RemoteConnection());
|
||||
return (new App\Service\Money(new GuzzleHttp\Client([
|
||||
'base_uri' => "http://{$remote->getIP()}:8080",
|
||||
'headers' => [
|
||||
'Accept' => 'application/json'
|
||||
]
|
||||
])))->getUF($date);
|
||||
}
|
||||
function format($tipo, $valor, $format = null, $print = false) {
|
||||
if ($valor === null) {
|
||||
|
Reference in New Issue
Block a user