diff --git a/app/controllers/admins/dashboards_controller.rb b/app/controllers/admins/dashboards_controller.rb index 37b69dc0d..d999b731d 100644 --- a/app/controllers/admins/dashboards_controller.rb +++ b/app/controllers/admins/dashboards_controller.rb @@ -65,9 +65,19 @@ class Admins::DashboardsController < Admins::BaseController CommitLog.count end - @subject_name = ["用户数", "项目数", "组织数", "Issue数", "Issue评论数", "PR数", "Commit数"] - @subject_icon = ["fa-user","fa-git", "fa-sitemap", "fa-warning", "fa-comments", "fa-share-alt", "fa-upload"] - @subject_data = [@user_count, @project_count, @organization_count, @issue_count, @comment_count, @pr_count, @commit_count] + @maven_count = Rails.cache.fetch("dashboardscontroller:platform:maven_count", expires_in: 1.days) do + result = ActiveRecord::Base.connection.select_all("SELECT * FROM pm_nexus_statistics where format ='maven' order by id desc limit 1") + result.rows[0][:count] + end + + @pypi_count = Rails.cache.fetch("dashboardscontroller:platform:pypi_count", expires_in: 1.days) do + result = ActiveRecord::Base.connection.select_all("SELECT * FROM pm_nexus_statistics where format ='pypi' order by id desc limit 1") + result.rows[0][:count] + end + + @subject_name = ["用户数", "项目数", "组织数", "Issue数", "Issue评论数", "PR数", "Commit数", "Maven数", "Pypi数"] + @subject_icon = ["fa-user","fa-git", "fa-sitemap", "fa-warning", "fa-comments", "fa-share-alt", "fa-upload", "fa-cloud", "fa-star"] + @subject_data = [@user_count, @project_count, @organization_count, @issue_count, @comment_count, @pr_count, @commit_count, @maven_count, @pypi_count] if EduSetting.get("open_baidu_tongji").to_s == "true" tongji_service = Baidu::TongjiService.new