Merge branch 'pre_trustie_server' into trustie_server

This commit is contained in:
2024-01-15 11:28:49 +08:00
15 changed files with 533 additions and 9 deletions

View File

@@ -0,0 +1,50 @@
<div>
数据来源百度统计,本周 [<%= @current_week_statistic.first&.date %> / <%= @current_week_statistic.last&.date %>]
</div>
<table class="table table-hover text-center subject-list-table">
<thead class="thead-light">
<tr>
<th width="20%">日期</th>
<th width="15%">访问量</th>
<th width="15%">访客数</th>
<th width="15%">IP数</th>
<th width="15%">直接访问占比</th>
<th width="15%">外部链接占比</th>
<th width="15%">搜索引擎占比</th>
<th width="20%">自定义</th>
</tr>
</thead>
<tbody>
<% @current_week_statistic.each_with_index do |week, index| %>
<tr class="">
<td><%= week.date %> </td>
<td><%= week.pv %></td>
<td><%= week.visitor %></td>
<td><%= week.ip %></td>
<td><%= week.source_through %>%</td>
<td><%= week.source_link %>%</td>
<td><%= week.source_search %>%</td>
<td><%= week.source_custom.to_f %>%</td>
</td>
</tr>
<% end %>
<!-- <tr class="">-->
<!-- <td><span style="color: #ff8200">合计</span></td>-->
<!-- <td><span style="color: #ff8200"><%#= @current_week_statistic.sum(:pv) %></span></td>-->
<!-- <td><span style="color: #ff8200"><%#= @current_week_statistic.sum(:visitor) %></span></td>-->
<!-- <td><span style="color: #ff8200"><%#= @current_week_statistic.sum(:ip) %></span></td>-->
<!-- </td>-->
<!-- </tr>-->
</tbody>
</table>
<% unless @access_token.present? && @overview_data.present? %>
<div>
<a href="/admins/baidu_tongji" target="_blank">1.百度统计需人工授权,点击去授权</a>
</div>
<div>
<a href="/admins/baidu_tongji_auth" onclick="this.href = '/admins/baidu_tongji_auth?code=' + document.getElementById('auth_code').value">2.获取百度统计授权码</a>
<input name="code" id="auth_code" style="width: 380px" placeholder="请输入1.百度统计返回的code后点击2.获取百度统计Token"/>
</div>
<% end %>

View File

@@ -0,0 +1,67 @@
<% if @access_token.present? && @overview_data.present? %>
<div>
数据来源百度统计,本周 <%= @overview_data['timeSpan'] %>
</div>
<table class="table table-hover text-center subject-list-table">
<thead class="thead-light">
<tr>
<th width="20%">日期</th>
<th width="15%">访问量</th>
<th width="15%">访客数</th>
<th width="15%">IP数</th>
</tr>
</thead>
<tbody>
<% pv_count = [] %>
<% visitor_count = [] %>
<% ip_count = [] %>
<% @overview_data['items'][0].each_with_index do |date, index| %>
<% pv = @overview_data['items'][1][index][0] %>
<% visitor = @overview_data['items'][1][index][1] %>
<% ip = @overview_data['items'][1][index][2] %>
<tr class="">
<td><%= date[0] %> </td>
<td><%= pv %></td>
<td><%= visitor %></td>
<td><%= ip %></td>
</td>
</tr>
<% pv_count.push(pv) %>
<% visitor_count.push(visitor) %>
<% ip_count.push(ip) %>
<% end %>
<tr class="">
<td><span style="color: #ff8200">合计</span></td>
<td><span style="color: #ff8200"><%= pv_count %></span></td>
<td><span style="color: #ff8200"><%= visitor_count %></span></td>
<td><span style="color: #ff8200"><%= ip_count %></span></td>
</td>
</tr>
</tbody>
</table>
<table class="table table-hover text-center subject-list-table">
<thead class="thead-light">
<tr>
<th width="15%">直接访问占比</th>
<th width="15%">外部链接占比</th>
<th width="15%">搜索引擎占比</th>
<th width="20%">自定义</th>
</tr>
</thead>
<tbody>
<tr class="">
<% @source_from_data['items'][1].each_with_index do |source, index| %>
<td><%= ((source[0].to_f / @source_from_data['sum'][0][0].to_f) * 100).round(2).to_s %>%</td>
<% end %>
</tr>
</tbody>
</table>
<% else %>
<div>
<a href="/admins/baidu_tongji" target="_blank">1.百度统计需人工授权,点击去授权</a>
</div>
<div>
<a href="/admins/baidu_tongji_auth" onclick="this.href = '/admins/baidu_tongji_auth?code=' + document.getElementById('auth_code').value">2.获取百度统计授权码</a>
<input name="code" id="auth_code" style="width: 380px" placeholder="请输入1.百度统计返回的code后点击2.获取百度统计Token"/>
</div>
<% end %>

View File

@@ -1,6 +1,35 @@
<% define_admin_breadcrumbs do %>
<% add_admin_breadcrumb('概览', admins_path) %>
<% end %>
<div class="header bg-gradient-primary pb-8 pt-md-8">
<div class="container-fluid">
<div class="header-body">
<!-- Card stats -->
<div class="row">
<%@subject_name.each_with_index do |subject, index| %>
<div class="col-xl-3 col-lg-6" style="padding-bottom: 15px;">
<div class="card card-stats mb-4 mb-xl-0">
<div class="card-body">
<div class="row">
<div class="col">
<h5 class="card-title text-uppercase11 text-muted mb-0"><%=subject %></h5>
<span class="h2 font-weight-bold mb-0"><%= @subject_data[index] %></span>
</div>
<div class="col-auto">
<div class="icon icon-shape rounded-circle shadow">
<i class="fa <%=@subject_icon[index] %>"></i>
</div>
</div>
</div>
</div>
</div>
</div>
<% end %>
</div>
</div>
</div>
</div>
<div class="box admin-list-container project-language-list-container">
<table class="table table-hover text-center subject-list-table">
@@ -53,6 +82,7 @@
</tr>
</tbody>
</table>
<%= render partial: 'admins/dashboards/baidu_tongji' %>
</div>
<div id="project-language-modals">
</div>