where('create_time', '>=', strtotime($startDate)); } if(is_null($endDate)){ $model = $model->where('create_time', '<', strtotime($startDate) + 86400); }else{ $model = $model->where('create_time', '<', strtotime($endDate) + 86400); } if($type == 'visit_user'){ $userIds = $model->distinct(true)->column('visitcode'); return count($userIds); }else if($type == 'visit_count'){ return $model->count(); } return 0; } }