fix error

This commit is contained in:
邱博亞 2021-12-01 11:21:20 +08:00
parent 03ea7ed804
commit a8be974144
1 changed files with 12 additions and 7 deletions

View File

@ -13,7 +13,7 @@ class Site
field :password_failed_lock_num, type: Integer, default: 5 field :password_failed_lock_num, type: Integer, default: 5
field :password_failed_lock_time, type: Integer, default: 1 field :password_failed_lock_time, type: Integer, default: 1
field :password_change_constrained, type: Integer, default: 0 field :password_change_constrained, type: Integer, default: 0
field :view_count_start, type: Integer, default: 0
field :social_share_hide_in_menu, type: Boolean, default: false field :social_share_hide_in_menu, type: Boolean, default: false
field :social_share_position, type: Integer, default: 0 field :social_share_position, type: Integer, default: 0
field :render_popup_only_on_root, type: Boolean, default: false field :render_popup_only_on_root, type: Boolean, default: false
@ -118,18 +118,19 @@ class Site
field :need_update_mobile_menu_cache , :type => Boolean, :default => true, localize: true field :need_update_mobile_menu_cache , :type => Boolean, :default => true, localize: true
field :has_sub_home , :type => Boolean, :default => false field :has_sub_home , :type => Boolean, :default => false
field :prohibit_general_memebers_access_backend_member_page , :type => Boolean, :default => false field :prohibit_general_memebers_access_backend_member_page , :type => Boolean, :default => false
field :avoid_member_display_in_wrong_show_page , :type => Boolean, :default => true
mount_uploader :default_image, ImageUploader mount_uploader :default_image, ImageUploader
mount_uploader :site_logo, ImageUploader mount_uploader :site_logo, ImageUploader
mount_uploader :site_logo_1, ImageUploader mount_uploader :site_logo_1, ImageUploader
mount_uploader :favicon, ImageUploader mount_uploader :favicon, ImageUploader
mount_uploader :mobile_icon, ImageUploader mount_uploader :mobile_icon, ImageUploader
before_save do before_save do
begin # begin
cache_header(false) # cache_header(false)
rescue => e # rescue => e
File.open("test.html","w+"){|f| f.write(e.backtrace.join(""))} # File.open("test.html","w+"){|f| f.write(e.backtrace.join(""))}
puts "cache header failed" # puts "cache header failed"
end # end
end end
after_save do after_save do
File.open("config/member_extra_db.txt","w+"){|f| f.write(self.member_extra_db)} File.open("config/member_extra_db.txt","w+"){|f| f.write(self.member_extra_db)}
@ -152,6 +153,10 @@ class Site
end end
end end
end end
def default_locale
tmp = super()
tmp.blank? ? "zh_tw" : tmp
end
def register_site(url,university,department,email,country) def register_site(url,university,department,email,country)
api_key = STORE_CONFIG[:store_settings]["api_key"] api_key = STORE_CONFIG[:store_settings]["api_key"]
self.generate_site_token self.generate_site_token