update api

This commit is contained in:
Afiq
2021-01-03 11:01:28 +08:00
parent be3f221201
commit 2bea4a1d29
2 changed files with 16 additions and 16 deletions
+13 -13
View File
@@ -61,14 +61,14 @@ class CustomerController extends Controller
return response()->json($customer_all);
}
public function showOneCustomerByICMobile(Request $request){
public function showOneCustomerByICMobile($ic){
$cawangan_all = Cawangan::on('mysql7')->get();
$customer_all = [];
foreach($cawangan_all as $index=>$cawangan){
$customer = Customer::on($cawangan['mysql'])
->where('kplama','=',$request->ic)
->orWhere('kpbaru','=',$request->ic)
->where('kplama','=',$ic)
->orWhere('kpbaru','=',$ic)
->first();
if($customer != null){
array_push($customer_all,$customer);
@@ -118,30 +118,30 @@ class CustomerController extends Controller
return response()->json($gadai_all);
}
public function showOneCustomerGadaiMobile(Request $request){
if($request->status == 'belum_tebus'){
public function showOneCustomerGadaiMobile($ic,$status){
if($status == 'belum_tebus'){
$gadai_status = '';
}elseif($request->status == 'sudah_tebus'){
}elseif($status == 'sudah_tebus'){
$gadai_status = 'T';
}elseif($request->status == 'lelong'){
}elseif($status == 'lelong'){
$gadai_status = 'L';
}
$cawangan_all = Cawangan::on('mysql7')->get();
$gadai_all = [];
foreach($cawangan_all as $index=>$cawangan){
if($request->status == 'belum_tebus' || $request->status == 'sudah_tebus'){
if($status == 'belum_tebus' || $status == 'sudah_tebus'){
$gadai = Gadai::on($cawangan['mysql'])
->where([['sttebus','=',$gadai_status],['nokp','=',$request->ic]])
->where([['sttebus','=',$gadai_status],['nokp','=',$ic]])
->get();
if(sizeof($gadai) != 0){
foreach($gadai as $index => $gadai_detail){
array_push($gadai_all,['norujukan'=>$gadai_detail['norujukan'],'hargajualan'=>$gadai_detail['hargajualan'],'bakihargajualan'=>$gadai_detail['bakihargajualan']]);
}
}
}elseif($request->status == 'lelong'){
}elseif($status == 'lelong'){
$gadai = Gadai::on($cawangan['mysql'])
->where([['sttebus','=',$gadai_status],['nokp','=',$request->ic]])
->where([['sttebus','=',$gadai_status],['nokp','=',$ic]])
->rightJoin('lelong', 'gadai.norujukan', '=', 'lelong.norujukan')
->get();
if(sizeof($gadai) != 0){
@@ -155,12 +155,12 @@ class CustomerController extends Controller
return response()->json($gadai_all);
}
public function show6BlnGadai(Request $request){
public function show6BlnGadai($ic){
$cawangan_all = Cawangan::on('mysql7')->get();
$gadai_all=[];
foreach($cawangan_all as $index=>$cawangan){
$gadai = Gadai::on($cawangan['mysql'])
->where([['sttebus','=',''],['nokp','=',$request->ic],['jbg','>=',6]])
->where([['sttebus','=',''],['nokp','=',$ic],['jbg','>=',6]])
->get();
if(sizeof($gadai) != 0){
foreach($gadai as $index => $gadai_detail){
+3 -3
View File
@@ -191,9 +191,9 @@ $router->group(['prefix'=>'api'], function () use ($router){
});
$router->group(['prefix'=>'mobile'], function () use ($router){
$router->post('customers/details',['uses'=>'CustomerController@showOneCustomerByICMobile']);
$router->post('customers/gadai',['uses'=>'CustomerController@showOneCustomerGadaiMobile']);
$router->post('customers/gadai/amaran/lelong',['uses'=>'CustomerController@show6BlnGadai']);
$router->get('customers/{ic}',['uses'=>'CustomerController@showOneCustomerByICMobile']);
$router->get('customers/{ic}/gadai/{status}',['uses'=>'CustomerController@showOneCustomerGadaiMobile']);
$router->get('customers/{ic}/gadai/amaran/lelong',['uses'=>'CustomerController@show6BlnGadai']);
$router->get('harga_emas',['uses'=>'HargaEmasController@showAllHargaEmasMobile']);
});