是否开启百度统计
This commit is contained in:
parent
d20a7b65c2
commit
1ed41b93d8
|
@ -69,26 +69,26 @@ class Admins::DashboardsController < Admins::BaseController
|
|||
@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]
|
||||
|
||||
|
||||
tongji_service = Baidu::TongjiService.new
|
||||
@access_token = tongji_service.access_token
|
||||
Rails.logger.info "baidu_tongji_auth access_token ===== #{@access_token}"
|
||||
# @overview_data = tongji_service.api_overview
|
||||
last_date = DailyPlatformStatistic.order(:date).last
|
||||
start_date = last_date.date
|
||||
end_date = Time.now
|
||||
if @access_token.present?
|
||||
@overview_data = Rails.cache.fetch("dashboardscontroller:baidu_tongji:overview_data", expires_in: 10.minutes) do
|
||||
tongji_service.source_from_batch_add(start_date, end_date)
|
||||
@overview_data = tongji_service.overview_batch_add(start_date, end_date)
|
||||
@overview_data
|
||||
if EduSetting.get("open_baidu_tongji").to_s == "true"
|
||||
tongji_service = Baidu::TongjiService.new
|
||||
@access_token = tongji_service.access_token
|
||||
Rails.logger.info "baidu_tongji_auth access_token ===== #{@access_token}"
|
||||
# @overview_data = tongji_service.api_overview
|
||||
last_date = DailyPlatformStatistic.order(:date).last || Time.now
|
||||
start_date = last_date.date
|
||||
end_date = Time.now
|
||||
if @access_token.present?
|
||||
@overview_data = Rails.cache.fetch("dashboardscontroller:baidu_tongji:overview_data", expires_in: 10.minutes) do
|
||||
tongji_service.source_from_batch_add(start_date, end_date)
|
||||
@overview_data = tongji_service.overview_batch_add(start_date, end_date)
|
||||
@overview_data
|
||||
end
|
||||
end
|
||||
|
||||
@current_week_statistic = DailyPlatformStatistic.where(date: current_week)
|
||||
@pre_week_statistic = DailyPlatformStatistic.where(date: pre_week)
|
||||
end
|
||||
|
||||
@current_week_statistic = DailyPlatformStatistic.where(date: current_week)
|
||||
@pre_week_statistic = DailyPlatformStatistic.where(date: pre_week)
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -85,7 +85,9 @@
|
|||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<% if EduSetting.get("open_baidu_tongji").to_s == "true" %>
|
||||
<%= render partial: 'admins/dashboards/baidu_tongji' %>
|
||||
<% end %>
|
||||
</div>
|
||||
<div id="project-language-modals">
|
||||
</div>
|
Loading…
Reference in New Issue