This commit is contained in:
邓皓元 2019-05-10 18:20:03 +08:00
parent 1351b340a8
commit f9b442ff41

View File

@ -55,12 +55,14 @@ class CardService extends Service
if (isset($conditions['card_status'])) {
$conditions['type'] = [0, 1, 2];
$simArray = $this->orderCardPartitionRepository->selectRaw('sim')->withConditions($conditions)->orderBy('sim')->forPage($page, $limit)->get()->pluck('sim')->toArray();
$this->orderCardPartitionRepository->resetModel();
$subQuery = $this->orderCardPartitionRepository->selectRaw('sim')->withConditions($conditions)->currentModel();
$res = DB::table(DB::raw("({$subQuery->toSql()}) as sub"))
->select(DB::raw('count(*) as total'))
->mergeBindings($subQuery->getQuery())
->first();
$this->orderCardPartitionRepository->resetModel();
$total = $res->total;