select user_id,sum(floor(timestampdiff(minute,visit_time, leave_time) /10 ) ) as point
from visit_tb
group by user_id
order by 2 desc

小时差/10取整