Commit 1df65c1b authored by hangjun83's avatar hangjun83

财务开票模块更新

parent bc9a687d
...@@ -30,4 +30,24 @@ abstract class BaseRepository extends BaseRepositoryEloquent ...@@ -30,4 +30,24 @@ abstract class BaseRepository extends BaseRepositoryEloquent
{ {
return DB::connection($this->getConnectionName()); return DB::connection($this->getConnectionName());
} }
protected function pagePaginate($data, $total, $request)
{
$pageData = [];
$pageData['data'] = $data;
$pageData['total'] = $total;
$offset = $total;
if(isset($request['page_size']) && !empty($request['page_size'])){
$offset = $request['page_size'];
}
$pageData['total_page'] = ceil($total / $offset) - 1;
if($total == 0){
$pageData['total_page'] = 1;
}
$pageData['page_no'] = $request['page_no'];
return $pageData;
}
} }
...@@ -842,13 +842,16 @@ class InvoiceService ...@@ -842,13 +842,16 @@ class InvoiceService
} }
$invocieTotal = $this->invoiceRecordRepository->count($where); $invocieTotal = $this->invoiceRecordRepository->count($where);
$dataReturn = []; return $this->invoiceRecordRepository->pagePaginate($invoiceList,$invocieTotal,$requestParams);
/*$dataReturn = [];
$dataReturn['data'] = $invoiceList; $dataReturn['data'] = $invoiceList;
$dataReturn['total'] = $invocieTotal; $dataReturn['total'] = $invocieTotal;
$dataReturn['total_page'] = ceil($invocieTotal / $offset) - 1; $total = ceil($invocieTotal / $offset) - 1;
$dataReturn['page_no'] = $pageNo; $dataReturn['total_page'] = ceil($invocieTotal / $offset) - 1 == 0 ? 1;
$dataReturn['page_no'] = $pageNo;*/
return $dataReturn;
}catch(\Throwable $exception){ }catch(\Throwable $exception){
SimpleLogs::writeLog($exception->getMessage(),__CLASS__.':'.__FUNCTION__,'error'); SimpleLogs::writeLog($exception->getMessage(),__CLASS__.':'.__FUNCTION__,'error');
throw $exception; throw $exception;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment