This commit is contained in:
邓皓元 2019-05-10 17:51:52 +08:00
parent d5c186aa0b
commit 6bc77e7e91

View File

@ -52,16 +52,16 @@ class CardService extends Service
if (isset($conditions['card_status'])) {
$conditions['type'] = [0, 1, 2];
$total = $this->orderCardPartitionRepository->withConditions($conditions)->count();
$simArray = $this->orderCardPartitionRepository->selectRaw('sim')->withConditions($conditions)->orderBy('sim')->forPage($page, $limit)->get()->pluck('sim')->toArray();
$cards = $this->orderCardPartitionRepository->select($select)->whereIn('sim', $simArray)->get();
$cards = $this->orderCardPartitionRepository->select($select)->where('type', 0)->whereIn('sim', $simArray)->get();
} else {
$total = $this->orderCardPartitionRepository->withConditions($conditions)->count();
$cards = $this->orderCardPartitionRepository->select($select)->withConditions($conditions)->orderBy('created_at', 'desc')->forPage($page, $limit)->get();
}
$cards = static::transformer($cards);
$total = $this->orderCardPartitionRepository->withConditions($conditions)->count();
return new LengthAwarePaginator($cards, $total, $limit);
}