when($type != '', function ($query) use ($type) { $query->where('channel_type', $type); })->where(function ($query) use ($time) { if ($time[0] == $time[1]) { $query->whereDay('create_time', $time[0]); } else { $time[1] = $time[1] + 86400; $query->whereTime('create_time', 'between', $time); } })->field("FROM_UNIXTIME(create_time,'$timeType') as days,$str as num")->group('days')->select()->toArray(); } }