68 lines
3.2 KiB
Plaintext
68 lines
3.2 KiB
Plaintext
<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>
|
||
<% if @current_week_statistic.size ==1 && @pre_week_statistic.present? %>
|
||
<tr class="">
|
||
<td>上周合计</td>
|
||
<td><%= @pre_week_statistic.map(&:pv).sum %></td>
|
||
<td><%= @pre_week_statistic.map(&:visitor).sum %></td>
|
||
<td><%= @pre_week_statistic.map(&:ip).sum %></td>
|
||
<td><%= (@pre_week_statistic.map(&:source_through).sum.to_f / 7).round(2) %>%</td>
|
||
<td><%= (@pre_week_statistic.map(&:source_link).sum.to_f / 7).round(2) %>%</td>
|
||
<td><%= (@pre_week_statistic.map(&:source_search).sum.to_f / 7).round(2) %>%</td>
|
||
<td><%= ((@pre_week_statistic.map(&:source_custom) - [nil]).sum.to_f / 7).round(2) %>%</td>
|
||
</td>
|
||
</tr>
|
||
<% end %>
|
||
<% @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="">
|
||
<% current_week_size = @current_week_statistic.size %>
|
||
<td><span style="color: #ff8200">本周合计</span></td>
|
||
<td><span style="color: #ff8200"><%= @current_week_statistic.map(&:pv).sum %></span></td>
|
||
<td><span style="color: #ff8200"><%= @current_week_statistic.map(&:visitor).sum %></span></td>
|
||
<td><span style="color: #ff8200"><%= @current_week_statistic.map(&:ip).sum %></span></td>
|
||
<td><span style="color: #ff8200"><%= (@current_week_statistic.map(&:source_through).sum.to_f / current_week_size).round(2) %>%</span></td>
|
||
<td><span style="color: #ff8200"><%= (@current_week_statistic.map(&:source_link).sum.to_f / current_week_size).round(2) %>%</span></td>
|
||
<td><span style="color: #ff8200"><%= (@current_week_statistic.map(&:source_search).sum.to_f / current_week_size).round(2) %>%</span></td>
|
||
<td><span style="color: #ff8200"><%= ((@current_week_statistic.map(&:source_custom) - [nil]).sum.to_f / current_week_size).round(2) %>%</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 %> |