From 153b392a39082fa611f3d1ac9b16bd48c6676eaa Mon Sep 17 00:00:00 2001 From: wangxinglong <2371974647@qq.com> Date: Thu, 23 Dec 2021 15:08:48 +0800 Subject: [PATCH] settter --- app/repository/BillRepository.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/app/repository/BillRepository.php b/app/repository/BillRepository.php index 301d408..f8c1d74 100644 --- a/app/repository/BillRepository.php +++ b/app/repository/BillRepository.php @@ -82,8 +82,13 @@ class BillRepository extends Repository */ public function apiBillList($page, $size, $businessCode = null,$startTime = null, $endTime = null, $orders = ["id" => "desc"]) { - - return CouponBill::with(["couponMain","account"]) + $failData = [ + 'total' => 0, + 'current' => $page, + 'size' => $size, + 'list' => new Collection(), + ]; + $rep = CouponBill::with(["couponMain","account"]) ->when(!empty($businessCode), function ($q) use ($businessCode) { $q->where("business_code", "=", $businessCode); }) @@ -92,10 +97,13 @@ class BillRepository extends Repository }) ->when(!empty($endTime), function ($q) use ($endTime) { $q->whereTime("create_time", "<=", $endTime); - }) - ->page($page,$size) + }); + ; + $failData["total"] = $rep->count(); + $failData["list"] = $rep->page($page,$size) ->order($orders) ->select(); + return $failData; }