From 129652f10173b45fe467f878bfb45e9f5655f525 Mon Sep 17 00:00:00 2001 From: Amir Date: Sun, 12 Jun 2022 10:18:33 +0800 Subject: [PATCH] add api listBidItemWeb, historyFeePay --- .../Mobile/LelongMobileController.php | 48 ++++++++++++++++--- routes/api.php | 3 +- 2 files changed, 44 insertions(+), 7 deletions(-) diff --git a/app/Http/Controllers/Mobile/LelongMobileController.php b/app/Http/Controllers/Mobile/LelongMobileController.php index 27fffe79..bc92fc18 100644 --- a/app/Http/Controllers/Mobile/LelongMobileController.php +++ b/app/Http/Controllers/Mobile/LelongMobileController.php @@ -154,12 +154,12 @@ class LelongMobileController extends Controller // please do not delete this changes // backup web pembida - public function listBidItemWeb(Request $request){ + public function listBidItemWeb($user_id, Request $request){ $lelongbidder = LelongBidder::join('lelongbid', 'lelongbidder.lelongbid_id', '=', 'lelongbid.id') ->where('user_id','=', $request->user_id) - ->select('lelongbid.lelong_id') - ->groupBy('lelongbid.lelong_id') + ->select('lelongbid.lelong_id', 'lelongbid.t_lelong') + ->groupBy('lelongbid.lelong_id', 'lelongbid.t_lelong') ->get()->toArray(); foreach($lelongbidder as $index1=>$lelbid) @@ -169,10 +169,46 @@ class LelongMobileController extends Controller ->where('lelongbidder.user_id', $request->user_id) ->get()->toArray(); - $lelongbidder[$index1]['lelongbid'] = $lelongbid; - } + $lelongbidder[$index1]['lelongbid']=$lelongbid; - return response()->json($lelongbidder); + } + return response()->json($lelongbidder); + } + + public function historyFeePay (Request $request) + { + $checkpay = Payment::join('resit', 'payment.resit_id', '=', 'resit.id') + ->where('resit.user_id', $request->user_id) + ->where('payment.lelong_id', $request->lelong_id) + ->where('payment.status', 1) + ->where('resit.resit_type', 1) + ->select('resit.id as resit id', + 'resit.resit_type', + 'resit.status as resit_status', + 'resit.paid_at', + 'payment.id as payment_id', + 'payment.lelong_id', + 'payment.status as payment_status' + ) + ->first(); + + if($checkpay) + { + $response = + [ + "message" => "Success", + "status" => 1 + ]; + } + else + { + $response = + [ + "message" => "Sila buat pembayaran yuran terlebih dahulu", + "status" => 2 + ]; + } + return response()->json($response, 201) ; } public function searchLelByCaw(Request $request){ diff --git a/routes/api.php b/routes/api.php index b916615c..bd38ddcf 100644 --- a/routes/api.php +++ b/routes/api.php @@ -64,7 +64,8 @@ Route::group(['middleware' => ['auth:sanctum']], function () { // Lelong => Bidder Route::post('/bidder/biditem', [LelongMobileController::class, 'bidderSelectBidItem']); Route::get('/bidder/listbiditem', [LelongMobileController::class, 'listBidItem']); - Route::get('/bidder/listBidItemWeb', [LelongMobileController::class, 'listBidItemWeb']); + Route::get('/bidder/listBidItemWeb/{user_id}', [LelongMobileController::class, 'listBidItemWeb']); + Route::get('/bidder/historyFeePay', [LelongMobileController::class, 'historyFeePay']); Route::post('/bidder/updatebiditem', [LelongMobileController::class, 'updatebiditem']); });