From 8cbf82fb2d95fa89ece30f81bb2fe5858cf1c86b Mon Sep 17 00:00:00 2001 From: "HESU\\HESU" <1696136552@qq.com> Date: Wed, 26 Mar 2025 09:50:10 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AD=9B=E9=80=89=E8=B7=9F=E8=BF=9B=E5=88=97?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/CustomerController.php | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/app/controller/CustomerController.php b/app/controller/CustomerController.php index b1c9e14..b19d9cb 100644 --- a/app/controller/CustomerController.php +++ b/app/controller/CustomerController.php @@ -66,20 +66,31 @@ class CustomerController public function waitFollow(Request $request) { $userId = $request->user['id']; + $filter = Util::getParam($request, 'filter'); + $page = $request->input('page', 1); + $perPage = $request->input('per_page', 10); $where = [ ['user_id', '=', $userId], ['follow_next', '<>', 0], -// ['follow_next', '<=', time() + 3600 * 24], -// ['follow_next', '>', time()], -// ['warn', '<', 1] ]; - $customer = Customer::where($where)->whereNotNull('follow_next')->orderBy('follow_next')->get(); + + if($filter == 0){ + $where[] = ['follow_next', '<=', time() + 3600 * 24]; + }elseif($filter == 1){ + $where[] = ['follow_next', '<=', time() + 3600 * 24*3]; + }elseif($filter == 2){ + $where[] = ['follow_next', '<=', time() + 3600 * 24*7]; + } + $customer = Customer::where($where) + ->whereNotNull('follow_next') + ->orderBy('follow_next') + ->paginate($perPage, ['*'], 'page', $page); foreach ($customer as &$item) { $item['follow_remaining'] = $item->follow_next-time(); $item['follow_next'] = date('Y-m-d H:i:s',$item->follow_next); } - return Util::success($customer,trans('success')); + return Util::page($customer); } /**