Merge branch 'ujrah_master' of https://bitbucket.org/arrahn-pkb/api_arrahn into finadev

This commit is contained in:
Afrina Alimi
2024-01-08 09:40:16 +08:00
2 changed files with 48 additions and 22 deletions
@@ -82,23 +82,37 @@ class CawanganDebugConnections extends Command
$filteredConnections = filterArraysByDatabaseNames($all_cawangan, $all_cawangan_in_config); $filteredConnections = filterArraysByDatabaseNames($all_cawangan, $all_cawangan_in_config);
$isOK = true;
// checks if there is connection errors // checks if there is connection errors
if (Helper::getInactiveCawanganDbConnection() > 0) { if (sizeof(Helper::getInactiveCawanganDbConnection()) > 0) {
dump('Inactive cawangan connection detected : '); dump('Inactive cawangan connection detected : ');
dump('1. Check DB_HOST in .env status is alive and available');
dump('2. Check database in .env exist in DB_HOST');
dump('');
dump(Helper::getInactiveCawanganDbConnection()); dump(Helper::getInactiveCawanganDbConnection());
$isOK = false;
} }
// checks if config connection do not exist referring to arrahn_master_db // checks if config connection do not exist referring to arrahn_master_db
if (count($all_cawangan) !== count($all_cawangan_in_config)) { if (count($all_cawangan) !== count($all_cawangan_in_config)) {
$db_not_config = array_diff(array_column($all_cawangan, 'db_name'), array_column($all_cawangan_in_config, 'database')); $db_not_config = array_diff(array_column($all_cawangan, 'db_name'), array_column($all_cawangan_in_config, 'database'));
dump(implode(', ', $db_not_config) . ' not configured in database config'); dump(implode(', ', $db_not_config) . ' exist in arrahn_master_db but not configured in config/database.php');
$isOK = false;
} }
// checks if config connection databases are not tally fwith arrahn master db // checks if config connection databases are not tally fwith arrahn master db
if (count($filteredConnections) !== 0) { if (count($filteredConnections) !== 0) {
dump('Database config names are not tally arrahn_master_db : '); dump('Database config names are not tally arrahn_master_db : ');
dump($filteredConnections); dump($filteredConnections);
$isOK = false;
} }
if($isOK == true){
dump('Cawangan database configuration is OK');
}
} }
} }
+32 -20
View File
@@ -254,7 +254,9 @@ class CallCenterController extends Controller
// dd($cawangan['kodcaw']); // dd($cawangan['kodcaw']);
// dd($cawangan); // dd($cawangan);
$notisbycaw = NotisPeringatan::on('mysql7') $notisbycaw = NotisPeringatan::on('mysql7')
->where('notisperingatan.notis_id',$notisid)->where('notisperingatan.kodcaw',$cawangan['kodcaw']) ->where('notisperingatan.notis_id',$notisid)
->where('notisperingatan.kodcaw',$cawangan['kodcaw'])
->where('notisperingatan.tarikhnotis1','=', NULL)
->distinct() ->distinct()
->get(); ->get();
// dd($notisbycaw); // dd($notisbycaw);
@@ -274,7 +276,9 @@ class CallCenterController extends Controller
$cawnotis_all = []; $cawnotis_all = [];
$cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first(); $cawangan = Cawangan::on('mysql7')->where('kodcaw','=',$kodcaw)->first();
$notisbycaw = NotisPeringatan::on('mysql7') $notisbycaw = NotisPeringatan::on('mysql7')
->where('notisperingatan.notis_id',$notisid)->where('notisperingatan.kodcaw',$kodcaw) ->where('notisperingatan.notis_id',$notisid)
->where('notisperingatan.kodcaw',$kodcaw)
->where('notisperingatan.tarikhnotis1', '=', NULL)
->distinct() ->distinct()
->get(); ->get();
@@ -567,6 +571,7 @@ class CallCenterController extends Controller
public function kemaskininotisperingatan(Request $request) public function kemaskininotisperingatan(Request $request)
{ {
// dd($request->all());
$notisid = $request->notisid; $notisid = $request->notisid;
$current = Carbon::now(); $current = Carbon::now();
$current = new Carbon(); $current = new Carbon();
@@ -591,6 +596,7 @@ class CallCenterController extends Controller
$checkgadai = Gadai::on($cawangan['mysql']) $checkgadai = Gadai::on($cawangan['mysql'])
->where([['norujukan','=',$notis['norujukan']]]) ->where([['norujukan','=',$notis['norujukan']]])
->first(); ->first();
if($checkgadai->sttebus == 'T' || $checkgadai->sttebus == 'L'){ if($checkgadai->sttebus == 'T' || $checkgadai->sttebus == 'L'){
$updatelistnotis=NotisPeringatan::on('mysql7') $updatelistnotis=NotisPeringatan::on('mysql7')
->where('norujukan','=', $notis['norujukan']) ->where('norujukan','=', $notis['norujukan'])
@@ -599,6 +605,22 @@ class CallCenterController extends Controller
->delete(); ->delete();
}elseif($checkgadai->sttebus == ''){ }elseif($checkgadai->sttebus == ''){
if($checkgadai->tagbaru == '0'){
// dd($notis['norujukan']);
$keuntungan = 'asal';
$jeniskeuntungan = ($keuntungan == 'onepercent') ? 'onepercent' : 'asal';
$master = new MasterServices($kodcaw);
$response = $master->kiraUpahTawarruq($kodcaw,$notis['norujukan'],$jeniskeuntungan);
}elseif($checkgadai->tagbaru == '1'){
$keuntungan = 'onepercent';
$jeniskeuntungan = ($keuntungan == 'onepercent') ? 'onepercent' : 'asal';
$master = new MasterServices($kodcaw);
$response = $master->kiraupahUjrahOnePercent($kodcaw,$notis['norujukan']);
}
// dd($response);
$updatedata = NotisPeringatan::on('mysql7') $updatedata = NotisPeringatan::on('mysql7')
->where('norujukan',$notis['norujukan']) ->where('norujukan',$notis['norujukan'])
->where('notis_id','=', $notisid) ->where('notis_id','=', $notisid)
@@ -606,6 +628,7 @@ class CallCenterController extends Controller
->update([ ->update([
'jbg'=> $checkgadai->tempoh, 'jbg'=> $checkgadai->tempoh,
'pinjaman'=> $checkgadai->bakipjm, 'pinjaman'=> $checkgadai->bakipjm,
'bakiupah'=> $response
]); ]);
} }
} }
@@ -891,10 +914,13 @@ class CallCenterController extends Controller
->where('notisperingatan.peringatan',2) ->where('notisperingatan.peringatan',2)
->where('notisperingatan.tarikhnotis2','=', NULL) ->where('notisperingatan.tarikhnotis2','=', NULL)
->distinct() ->distinct()
->get(); ->get()->toArray();
// dd($notisbycaw); // dd($notisbycaw);
if(empty($notisbycaw)){
// dd(false);
return response()->json('failed');
}else{
// dd(true);
$arraynorujukan = $notisbycaw->pluck('norujukan')->toArray(); $arraynorujukan = $notisbycaw->pluck('norujukan')->toArray();
$gadainokp = Gadai::on($cawangan['mysql'])->whereIn('norujukan', $arraynorujukan) $gadainokp = Gadai::on($cawangan['mysql'])->whereIn('norujukan', $arraynorujukan)
@@ -937,22 +963,8 @@ class CallCenterController extends Controller
dispatch(new ARCCSMSPelangganSAGLAMAbysag($nokp,$customer->telefon,$caw_name,$nofoncaw,$kodcaw,$cal->norujukan,$cal->tempoh,$cal->t_matang,$cal->t_matang1,$cal->lelong_tawarruq,$namapengguna)); dispatch(new ARCCSMSPelangganSAGLAMAbysag($nokp,$customer->telefon,$caw_name,$nofoncaw,$kodcaw,$cal->norujukan,$cal->tempoh,$cal->t_matang,$cal->t_matang1,$cal->lelong_tawarruq,$namapengguna));
} }
} }
// $updatestatusnotis=CawanganNotis::on('mysql7')
// ->where('notis_id','=', $notisid)
// ->where('kodcaw','=', $kodcaw)
// ->update(
// array('status'=> 2));
return response()->json('success'); return response()->json('success');
} }
}
//}
// else{
// return response()->json('failed');
// }
// }
} }