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