Perbaikan P1 Remunerasi
This commit is contained in:
@@ -290,12 +290,19 @@ class DawaiService
|
||||
}
|
||||
|
||||
public function getDataP1(?string $jenisPegawai, int $tahun, int $bulan, ?int $unit)
|
||||
{
|
||||
$response = $this->getDataP1Response($jenisPegawai, $tahun, $bulan, $unit);
|
||||
|
||||
return $response['data'] ?? [];
|
||||
}
|
||||
|
||||
public function getDataP1Response(?string $jenisPegawai, int $tahun, int $bulan, ?int $unit): array
|
||||
{
|
||||
try {
|
||||
$response = $this->client->get("api/v1/psatu/$tahun/$bulan/?id_unit=$unit&jenis_pegawai=$jenisPegawai");
|
||||
$data = json_decode($response->getBody()->getContents(), true)['data'];
|
||||
$data = json_decode($response->getBody()->getContents(), true);
|
||||
|
||||
return $data;
|
||||
return is_array($data) ? $data : [];
|
||||
} catch (Throwable $th) {
|
||||
Log::error('DAWAI : '.$th->getMessage());
|
||||
throw new Error($th->getMessage(), 500);
|
||||
@@ -303,12 +310,19 @@ class DawaiService
|
||||
}
|
||||
|
||||
public function getDataP1Selisih(?string $jenisPegawai, int $tahun, int $bulan, ?int $unit)
|
||||
{
|
||||
$response = $this->getDataP1SelisihResponse($jenisPegawai, $tahun, $bulan, $unit);
|
||||
|
||||
return $response['data'] ?? [];
|
||||
}
|
||||
|
||||
public function getDataP1SelisihResponse(?string $jenisPegawai, int $tahun, int $bulan, ?int $unit): array
|
||||
{
|
||||
try {
|
||||
$response = $this->client->get("api/v1/psatu/$tahun/$bulan/?id_unit=$unit&jenis_pegawai=$jenisPegawai&selisih=true");
|
||||
$data = json_decode($response->getBody()->getContents(), true)['data'];
|
||||
$data = json_decode($response->getBody()->getContents(), true);
|
||||
|
||||
return $data;
|
||||
return is_array($data) ? $data : [];
|
||||
} catch (Throwable $th) {
|
||||
Log::error('DAWAI : '.$th->getMessage());
|
||||
throw new Error($th->getMessage(), 500);
|
||||
|
||||
Reference in New Issue
Block a user