forked from Trustie/forgeplus
30 lines
1.1 KiB
Ruby
30 lines
1.1 KiB
Ruby
class HomeController < ApplicationController
|
|
|
|
def to_competitions
|
|
competition_url = Rails.application.config_for(:configuration)['web_site'] || EduSetting.get('host_main_site')
|
|
redirect_to "#{competition_url}/competitions/#{params[:identifier].to_s}/home"
|
|
end
|
|
|
|
def to_cgk
|
|
tip_exception(401, "请登录后再操作") unless User.current.logged?
|
|
|
|
token = Token.get_token_from_user(User.current,'autologin')
|
|
cgk_url = EduSetting.get("outer_cgk_url") || "http://62.234.44.150:8500/osredm/achievement"
|
|
redirect_to "#{cgk_url}?token=#{token.value}"
|
|
end
|
|
|
|
def index
|
|
@user_count = Rails.cache.fetch("homecontroller:user_count", expires_in: 1.hours) do
|
|
User.count
|
|
end
|
|
@project_count = Rails.cache.fetch("homecontroller:project_count", expires_in: 1.hours) do
|
|
Project.count
|
|
end
|
|
@project_dataset_count = Rails.cache.fetch("homecontroller:project_dataset_count", expires_in: 1.hours) do
|
|
ProjectDataset.count
|
|
end
|
|
@commit_count = Rails.cache.fetch("homecontroller:commit_count", expires_in: 1.hours) do
|
|
CommitLog.count
|
|
end
|
|
end
|
|
end |