From 00e113d18d3386721f2a590c9e0e4d365f1852eb Mon Sep 17 00:00:00 2001 From: elf <360197197@qq.com> Date: Thu, 22 Jun 2023 16:12:08 +0800 Subject: [PATCH] th --- app/Controller/Recharge/RechargeController.php | 15 ++++++++++----- app/Request/ApiRequest.php | 3 +++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/app/Controller/Recharge/RechargeController.php b/app/Controller/Recharge/RechargeController.php index c19c0b6..cb3e848 100644 --- a/app/Controller/Recharge/RechargeController.php +++ b/app/Controller/Recharge/RechargeController.php @@ -277,6 +277,11 @@ class RechargeController extends AbstractController if (empty($appId)) { throw new UnauthorizedException(); } + if ($appId == 'all') { + $appIds = App::all()->pluck('app_id')->toArray(); + } else { + $appIds = explode(',', $appId); + } $offset = ($page - 1) * $pageSize; $query = Order::query()->where('app_id', $appId); @@ -284,15 +289,15 @@ class RechargeController extends AbstractController $query->where('status', $status); } if ($mobile) { - $memberIds = User::where('app_id', $appId)->where('mobile', $mobile)->get(['member_id'])->pluck('member_id')->toArray(); + $memberIds = User::whereIn('app_id', $appIds)->where('mobile', $mobile)->get(['member_id'])->pluck('member_id')->toArray(); $query->whereIn('member_id', $memberIds); } if ($cardNo) { - $memberIds = User::where('app_id', $appId)->where('card_no', $cardNo)->get(['member_id'])->pluck('member_id')->toArray(); + $memberIds = User::whereIn('app_id', $appIds)->where('card_no', $cardNo)->get(['member_id'])->pluck('member_id')->toArray(); $query->whereIn('member_id', $memberIds); } if ($bankCardNo) { - $protocols = BankCard::where('app_id', $appId)->where('bank_card_no', $bankCardNo)->get(['protocol'])->pluck('protocol')->toArray(); + $protocols = BankCard::whereIn('app_id', $appIds)->where('bank_card_no', $bankCardNo)->get(['protocol'])->pluck('protocol')->toArray(); $query->whereIn('protocol', $protocols); } if ($orderNo) { @@ -312,7 +317,7 @@ class RechargeController extends AbstractController $orders = $query->orderBy('id', 'desc')->offset($offset)->limit($pageSize)->get(); $protocols = $orders->pluck('protocol'); - $bankCards = BankCard::where('app_id', $appId)->whereIn('protocol', $protocols)->get(); + $bankCards = BankCard::whereIn('app_id', $appIds)->whereIn('protocol', $protocols)->get(); $bankCards = $bankCards->keyBy('protocol'); $records = []; @@ -366,7 +371,7 @@ class RechargeController extends AbstractController private function getUser($username) { $users = [ - 'owx0tlx' => ['password' => 'lSoLW28NxtMlxUazC8p', 'app_id' => '202304270000004'], + 'owx0tlx' => ['password' => 'lSoLW28NxtMlxUazC8p', 'app_id' => 'all'], 'ioexlp2' => ['password' => 'wwU8Ir3Xp0rxXssA9NV', 'app_id' => '202305270000001'], 'lix73nxIN' => ['password' => 'a01@lWl3dfNmT', 'app_id' => '202306140000001'], 'xtIxt2x3L' => ['password' => 'sd3@xxgNtxxJipOmT', 'app_id' => '202306200000001'], diff --git a/app/Request/ApiRequest.php b/app/Request/ApiRequest.php index 8fcce29..29002ac 100644 --- a/app/Request/ApiRequest.php +++ b/app/Request/ApiRequest.php @@ -47,6 +47,9 @@ class ApiRequest extends Request if (is_null($app)) { throw new BusinessException('APP错误'); } + if ($app->status != 1) { + throw new BusinessException('应用暂未启用'); + } $this->app = $app; }