diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 859f19f19..7744f20a4 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -105,6 +105,16 @@ class UsersController < ApplicationController redirect_to signin_url return end + # 记录当前点击按钮的时间 + if OnclickTime.where("user_id =?", User.current).first.nil? + message_new_time = OnclickTime.new + message_new_time.user_id = User.current.id + message_new_time.onclick_time = Time.now + message_new_time.save + else + message_new_time = OnclickTime.where("user_id =?", User.current) + message_new_time.update_attributes(:onclick_time => Time.now) + end # 当前用户查看消息,则设置消息为已读 if params[:viewed] == "all" course_querys = @user.course_messages