select user_id AS wxUserId,
MAX(`time`) AS time
from tb
where `time`>= #{startTime}
and #{endTime} >= `time`
group by user_id
ORDER BY MAX(`time`) desc
select user_id AS wxUserId,
MAX(`time`) AS time
from tb
where `time`>= #{startTime}
and #{endTime} >= `time`
group by user_id
ORDER BY MAX(`time`) desc