From dbddd9ddc87621f3c0bbfc015bc2b4d45338f14a Mon Sep 17 00:00:00 2001 From: cxt Date: Thu, 7 Mar 2019 14:24:23 +0800 Subject: [PATCH] =?UTF-8?q?=EF=BC=88=E8=B6=85=E7=BA=A7=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=EF=BC=89=E7=B3=BB=E7=BB=9F=E5=8D=87=E7=BA=A7=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E7=9A=84=E9=A1=B5=E9=9D=A2=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/managements_controller.rb | 1 + app/controllers/users_controller.rb | 2 +- app/views/layouts/_logined_header.html.erb | 2 +- app/views/managements/update_notice.html.erb | 6 ++++-- app/views/my/account.html.erb | 2 +- 5 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index b43e70df..d1450ef6 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -3127,6 +3127,7 @@ end notice = SystemUpdateNotice.last if notice.present? && notice.end_time > Time.now notice.update_attributes(:end_time => params[:end_time], :start_time => params[:start_time], :subject => params[:subject], :notes => params[:notes]) + UserSystemNotice.where(:notice_type => notice.notice_type).destroy_all else notice_type = UserSystemNotice.find_by_sql("select max(notice_type) as max_notice_type from user_system_notices").first.try(:max_notice_type).to_i + 1 SystemUpdateNotice.create(:end_time => params[:end_time], :start_time => params[:start_time], :subject => params[:subject], :notes => params[:notes], :notice_type => notice_type) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 2e958f6f..e44a170b 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -2372,7 +2372,7 @@ class UsersController < ApplicationController if @user.certification == 3 @user.update_column('certification', 0) @noticed = true - notice = SystemUpdateNotice.first + notice = SystemUpdateNotice.last if notice.present? && notice.end_time > Time.now && notice.start_time >= Time.now - 21600 && User.current.user_system_notices.where(:notice_type => notice.notice_type).count == 0 @noticed_update = true end diff --git a/app/views/layouts/_logined_header.html.erb b/app/views/layouts/_logined_header.html.erb index f48b5615..ee3a571d 100644 --- a/app/views/layouts/_logined_header.html.erb +++ b/app/views/layouts/_logined_header.html.erb @@ -117,7 +117,7 @@ <% end %> - <% notice = SystemUpdateNotice.first %> + <% notice = SystemUpdateNotice.last %> <% if @noticed_update || ((User.current.certification == 1 || params[:controller] != "welcome") && notice.present? && notice.end_time > Time.now && notice.start_time >= (Time.now - 21600) && User.current.user_system_notices.where(:notice_type => notice.notice_type).count == 0) %> var htmlvalue = "<%= escape_javascript(render :partial => 'account/user_update_notice', :locals => {:notice => notice})%>"; pop_box_new(htmlvalue, 500, 380); diff --git a/app/views/managements/update_notice.html.erb b/app/views/managements/update_notice.html.erb index 0cabe548..c0e1f254 100644 --- a/app/views/managements/update_notice.html.erb +++ b/app/views/managements/update_notice.html.erb @@ -11,8 +11,10 @@ <%= form_for '', :url => edit_update_notice_managements_path(), :html => {:id => 'edit_update_notice_form', :method => "post"} do |f| %> -
- + " + class="winput-240-35 mt10 mb15" id="notice_begin_time"/>
+ " + class="winput-240-35 mb10" id="notice_end_time"/> diff --git a/app/views/my/account.html.erb b/app/views/my/account.html.erb index 87f0403e..e70c3555 100644 --- a/app/views/my/account.html.erb +++ b/app/views/my/account.html.erb @@ -107,7 +107,7 @@ <% end %> <% end %> - <% notice = SystemUpdateNotice.first %> + <% notice = SystemUpdateNotice.last %> <% if User.current.certification == 1 && notice.present? && notice.end_time > Time.now && notice.start_time >= (Time.now - 21600) && User.current.user_system_notices.where(:notice_type => notice.notice_type).count == 0 %> var htmlvalue = "<%= escape_javascript(render :partial => 'account/user_update_notice', :locals => {:notice => notice})%>"; pop_box_new(htmlvalue, 500, 380);