Merged in izzati-hotfix-carian-nama (pull request #343)
update api untuk carian nama arcc
This commit is contained in:
@@ -1564,4 +1564,89 @@ class CallCenterController extends Controller
|
||||
}
|
||||
return response()->json($cawnotis_all);
|
||||
}
|
||||
|
||||
public function rekodgadai(Request $request)
|
||||
{
|
||||
$nokp = $request->nokp;
|
||||
$kodcaw = $request->kodcaw;
|
||||
// Dapatkan maklumat cawangan
|
||||
$cawangan = Cawangan::on('mysql7')
|
||||
->where('kodcaw', $kodcaw)
|
||||
->first();
|
||||
|
||||
if (!$cawangan || empty($cawangan->mysql)) {
|
||||
return response()->json([
|
||||
'status' => false,
|
||||
'message' => 'Cawangan tidak dijumpai atau konfigurasi DB tidak lengkap',
|
||||
'data' => []
|
||||
], 404);
|
||||
}
|
||||
|
||||
try {
|
||||
// Query rekod gadai dari DB cawangan yang betul
|
||||
$gadai = Gadai::on($cawangan->mysql)
|
||||
->where('nokp', $nokp)
|
||||
->get();
|
||||
|
||||
return response()->json([
|
||||
'status' => !$gadai->isEmpty(),
|
||||
'message' => $gadai->isEmpty() ? 'Tiada rekod gadai' : 'Rekod gadai dijumpai',
|
||||
'data' => $gadai
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json([
|
||||
'status' => false,
|
||||
'message' => 'Ralat semasa ambil data: ' . $e->getMessage(),
|
||||
'data' => []
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
public function rekodgadaiBatch(Request $request)
|
||||
{
|
||||
$nokpList = $request->input('nokp_list', []);
|
||||
$kodcaw = $request->input('kodcaw');
|
||||
|
||||
if (empty($nokpList) || empty($kodcaw)) {
|
||||
return response()->json([
|
||||
'status' => false,
|
||||
'message' => 'Parameter tidak lengkap',
|
||||
'data' => []
|
||||
], 400);
|
||||
}
|
||||
|
||||
$cawangan = Cawangan::on('mysql7')
|
||||
->where('kodcaw', $kodcaw)
|
||||
->first();
|
||||
|
||||
if (!$cawangan || empty($cawangan->mysql)) {
|
||||
return response()->json([
|
||||
'status' => false,
|
||||
'message' => 'Cawangan tidak dijumpai',
|
||||
'data' => []
|
||||
], 404);
|
||||
}
|
||||
|
||||
try {
|
||||
$gadai = Gadai::on($cawangan->mysql)
|
||||
->whereIn('nokp', $nokpList)
|
||||
->get();
|
||||
|
||||
return response()->json([
|
||||
'status' => !$gadai->isEmpty(),
|
||||
'message' => $gadai->isEmpty() ? 'Tiada rekod gadai' : 'Rekod gadai dijumpai',
|
||||
'data' => $gadai
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
return response()->json([
|
||||
'status' => false,
|
||||
'message' => 'Ralat semasa ambil data: ' . $e->getMessage(),
|
||||
'data' => []
|
||||
], 500);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -983,4 +983,6 @@ $router->group(['prefix'=>'arcc'], function () use ($router){
|
||||
$router->get('bysagnotisjbg2/{kodcaw}/{notisid}/{nokp}',['uses'=>'CallCenterController@bysagnotisjbg2']);
|
||||
$router->put('updatecall/{kodcaw}/{notisid}/{nokp}', ['uses' => 'CallCenterController@updatecall']);
|
||||
$router->get('bysagnotisjbgcustomer2/{kodcaw}/{notisid}/{nokp}',['uses'=>'CallCenterController@bysagnotisjbgCustomer2']);
|
||||
$router->get('rekodgadai',['uses'=>'CallCenterController@rekodgadai']);
|
||||
$router->post('rekodgadai-batch',['uses'=>'CallCenterController@rekodgadaiBatch']);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user