laboratory: index api modify

competitions
p31729568 5 years ago
parent 67b2108229
commit 5b749a055b

@ -10,6 +10,10 @@ module LaboratoryHelper
@_current_laboratory ||= (Laboratory.find_by_subdomain(request.subdomain) || Laboratory.find(1))
end
def default_laboratory
@_default_laboratory ||= Laboratory.find(1)
end
def default_setting
@_default_setting ||= LaboratorySetting.find_by(laboratory_id: 1)
end

@ -3,6 +3,8 @@ class HomeController < ApplicationController
def index
# banner图
images = current_laboratory.portal_images.only_online.order(position: :asc)
images = default_laboratory.portal_images.only_online.order(position: :asc) if images.blank? # 未设置时使用EduCoder的轮播图
@images_url = []
images.each do |image|
@images_url << {path: image.link, image_url: Util::FileManage.source_disk_file_url(image)}

Loading…
Cancel
Save