select user_id,
floor(
sum(TIMESTAMPDIFF(MINUTE, visit_time, leave_time)/10) 
)
AS point
from visit_tb
group by user_id
order by point desc