From ed5f14c9ebb2c0a3b06c3cd1d772ddca29eff7a8 Mon Sep 17 00:00:00 2001 From: huang Date: Sun, 6 Sep 2015 17:42:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=82=B9=E5=87=BB=E5=AF=B9?= =?UTF-8?q?=E5=BA=94=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/users_controller.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) 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