forked from Trustie/forgeplus
34 lines
1.2 KiB
Ruby
34 lines
1.2 KiB
Ruby
class StatisticController < ApplicationController
|
|
|
|
# 平台概况
|
|
def platform_profile
|
|
@platform_user_query = Statistic::PlatformUserQuery.new(params).call rescue [0, 0, 0]
|
|
@platform_project_query = Statistic::PlatformProjectQuery.new(params).call rescue [0, 0, 0]
|
|
@platform_course_query = Statistic::PlatformCourseQuery.new(params).call rescue [0, 0, 0]
|
|
end
|
|
|
|
# 平台代码提交数据
|
|
def platform_code
|
|
@platform_pull_request_query = Statistic::PlatformPullRequestQuery.new(params).call rescue [0, 0]
|
|
@platform_commit_query = Statistic::PlatformCommitQuery.new(params,current_user).call rescue [0, 0]
|
|
end
|
|
|
|
# 项目案例活跃度排行榜
|
|
def active_project_rank
|
|
@active_project_rank_query = Statistic::ActiveProjectRankQuery.new(params, current_user).call rescue []
|
|
end
|
|
|
|
# 开发者活跃度排行榜
|
|
def active_developer_rank
|
|
@active_developer_rank_query = Statistic::ActiveDeveloperRankQuery.new(params, current_user).call rescue []
|
|
end
|
|
|
|
def hot_keyword
|
|
key = "open_product_hot_keyword"
|
|
@hot_keyword = Rails.cache.fetch(key)
|
|
if @hot_keyword.nil?
|
|
@hot_keyword = ProjectTopic.order(:projects_count).limit(3).pluck(:name)
|
|
Rails.cache.write(key, @hot_keyword, expires_in: 7.day)
|
|
end
|
|
end
|
|
end |