master
wangxinglong 2021-12-23 15:08:48 +08:00
parent 18ebd1fcc9
commit 153b392a39
1 changed files with 12 additions and 4 deletions

View File

@ -82,8 +82,13 @@ class BillRepository extends Repository
*/ */
public function apiBillList($page, $size, $businessCode = null,$startTime = null, $endTime = null, $orders = ["id" => "desc"]) public function apiBillList($page, $size, $businessCode = null,$startTime = null, $endTime = null, $orders = ["id" => "desc"])
{ {
$failData = [
return CouponBill::with(["couponMain","account"]) 'total' => 0,
'current' => $page,
'size' => $size,
'list' => new Collection(),
];
$rep = CouponBill::with(["couponMain","account"])
->when(!empty($businessCode), function ($q) use ($businessCode) { ->when(!empty($businessCode), function ($q) use ($businessCode) {
$q->where("business_code", "=", $businessCode); $q->where("business_code", "=", $businessCode);
}) })
@ -92,10 +97,13 @@ class BillRepository extends Repository
}) })
->when(!empty($endTime), function ($q) use ($endTime) { ->when(!empty($endTime), function ($q) use ($endTime) {
$q->whereTime("create_time", "<=", $endTime); $q->whereTime("create_time", "<=", $endTime);
}) });
->page($page,$size) ;
$failData["total"] = $rep->count();
$failData["list"] = $rep->page($page,$size)
->order($orders) ->order($orders)
->select(); ->select();
return $failData;
} }