where('province',$province); if( $city)$query = $query->where('city',$city); if( $district)$query = $query->where('district',$district); }; //统计当前课程总数 $count = ClassesLib::where($where)->sum(""); } }