From d0e73c12ffe4c8535735085a35f10abd9ec2091f Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 10 Mar 2017 14:59:24 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=AE=A8=E8=AE=BA=E5=8C=BA=E7=9A=84?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E7=8A=B6=E6=80=81=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/messages_controller.rb | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index 1c917ce7a..07fdd026d 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -58,7 +58,7 @@ class MessagesController < ApplicationController @reply = Message.new(:subject => "RE: #{@message.subject}") if @course #帖子消息状态更新 - course_messages = CourseMessage.where("user_id =? and course_message_type =? and course_id =? and viewed =?", User.current.id, 'Message', @course.id, 0) + course_messages = CourseMessage.where("user_id =? and course_message_type =? and course_message_id =? and course_id =? and viewed =?", User.current.id, 'Message', @topic.id, @course.id, 0) course_messages.update_all(:viewed => true) #@replies = @topic.children. #includes(:author, :attachments, :praise_tread_cache, {:board => :project}). @@ -67,10 +67,10 @@ class MessagesController < ApplicationController #offset(@reply_pages.offset). #all #@replies = paginateHelper messages_replies,10 - # 班级帖子消息设为已读 + # 班级帖子回复消息设为已读 @replies.each do |comment| - course_message = CourseMessage.where(:course_message_id => comment.id, :user_id => User.current.id, :viewed => 0) - course_message.update_all(:viewed => 1) + course_message = CourseMessage.where(:course_message_type => 'Message', :course_message_id => comment.id, :user_id => User.current.id, :viewed => 0) + course_message.update_all(:viewed => 1) end @left_nav_type = 2 respond_to do |format| @@ -80,7 +80,7 @@ class MessagesController < ApplicationController #render :action => "show", :layout => "base_courses"#by young elsif @project #帖子消息状态更新 - project_messages = ForgeMessage.where("user_id =? and forge_message_type =? and project_id =? and viewed =?", User.current.id, 'Message', @project.id, 0) + project_messages = ForgeMessage.where("user_id =? and forge_message_type =? and forge_message_id =? and project_id =? and viewed =?", User.current.id, 'Message', @topic.id, @project.id, 0) project_messages.update_all(:viewed => true) #@reply_pages = Paginator.new @reply_count, REPLIES_PER_PAGE, page # @replies = @topic.children. @@ -89,14 +89,25 @@ class MessagesController < ApplicationController # limit(@reply_pages.per_page). # offset(@reply_pages.offset). # all + # 项目帖子回复消息设为已读 + @replies.each do |comment| + project_message = ForgeMessage.where(:forge_message_type => 'Message', :forge_message_id => comment.id, :user_id => User.current.id, :viewed => 0) + project_message.update_all(:viewed => 1) + end respond_to do |format| format.js format.html {render :layout => 'base_projects'} end elsif @contest #帖子消息状态更新 - contest_messages = ContestMessage.where("user_id =? and contest_message_type =? and contest_id =? and viewed =?", User.current.id, 'Message', @contest.id, 0) + contest_messages = ContestMessage.where("user_id =? and contest_message_type =? and contest_message_id =? and contest_id =? and viewed =?", User.current.id, 'Message', @topic.id, @contest.id, 0) contest_messages.update_all(:viewed => true) + + # 竞赛帖子回复消息设为已读 + @replies.each do |comment| + contest_message = ContestMessage.where(:contest_message_type => 'Message', :contest_message_id => comment.id, :user_id => User.current.id, :viewed => 0) + contest_message.update_all(:viewed => 1) + end @left_nav_type = 4 respond_to do |format| format.js From d5472f667b543dd4b3bf71cc48881d8f059d65a3 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 10 Mar 2017 15:39:05 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E7=9A=84logo=E5=9C=A8?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=97=B6=E4=BC=9A=E5=87=BA=E7=8E=B0=E4=B8=8D?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E7=9A=84=E6=83=85=E5=86=B5=EF=BC=8C=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E7=9A=84=E6=98=AF=E4=B8=80=E4=B8=AA=E6=96=87=E6=9C=AC?= =?UTF-8?q?=E7=9A=84=EF=BC=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/avatar_controller.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/controllers/avatar_controller.rb b/app/controllers/avatar_controller.rb index 8a383f6f9..228f20599 100644 --- a/app/controllers/avatar_controller.rb +++ b/app/controllers/avatar_controller.rb @@ -75,6 +75,10 @@ class AvatarController < ApplicationController end @temp_file = nil + while !File.exist?(diskfile) + sleep(0.5) + end + respond_to do |format| format.json{ render :inline => {status: @status, message:@msg, url:"#{@urlfile.to_s}?#{Time.now.to_i}"}.to_json,:content_type => 'text/html'