Commit 2ee26024 by 杨昕

修改媒资统计条数

parent 50ec722d
Pipeline #10249 passed with stages
in 41 seconds
...@@ -79,8 +79,16 @@ class MediaModel extends Eloquent ...@@ -79,8 +79,16 @@ class MediaModel extends Eloquent
} }
$aggregate[]['$sort'] = ['start_time' => $sort]; $aggregate[]['$sort'] = ['start_time' => $sort];
$count = sizeof($collection->aggregate($aggregate)->toArray());
$aggregate1=$aggregate;
$aggregate1[]['$group'] = [
'_id' => array(),//更具性别进行分组
'count'=>array('$sum'=>1)
];
$count = $collection->aggregate($aggregate1)->toArray()[0]['count'];
$skip = ((empty($request->page) ? 1 : $request->page)-1) * $limit; $skip = ((empty($request->page) ? 1 : $request->page)-1) * $limit;
...@@ -99,6 +107,7 @@ class MediaModel extends Eloquent ...@@ -99,6 +107,7 @@ class MediaModel extends Eloquent
}catch (\Exception $exception){ }catch (\Exception $exception){
throw new DatabaseException($exception->getMessage()); throw new DatabaseException($exception->getMessage());
} }
return $medias; return $medias;
} }
......
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