dev_aliyun
cxt 5 years ago
commit d49824cf0e

@ -258,7 +258,7 @@ class CollegesController < ApplicationController
unless (User.current.admin? || User.current.business? || unless (User.current.admin? || User.current.business? ||
(@department.present? && DepartmentMember.where(:user_id => User.current.id, :department_id => @department.id).first.present?) || (@department.present? && DepartmentMember.where(:user_id => User.current.id, :department_id => @department.id).first.present?) ||
(User.current.user_extensions.try(:school_id) == @school.id && User.current.user_extensions.try(:identity) == 0) || (User.current.user_extensions.try(:school_id) == @school.id && User.current.user_extensions.try(:identity) == 0) ||
(@school.try(:customer_id) && User.current.try(:partner).try(:customer_ids) && User.current.try(:partner).try(:customer_ids).include?(@school.try(:customer_id)))) (@school.try(:customer_id) && User.current.try(:partner).try(:customer_ids) && User.current.try(:partner).try(:customer_ids).include?(@school.try(:customer_id))))
render_403 render_403
end end
end end

@ -29,12 +29,21 @@ class ManagementsController < ApplicationController
end end
def user_agents def user_agents
@user_agents = UserAgent.where("user_agents.key is not order by action_status, register_status") @user_agents = UserAgent.where("user_agents.key is not null").order("action_status asc, register_status asc")
@agents_count = @user_agents.count @agents_count = @user_agents.count
limit = 20 limit = 20
@agents_pages = Paginator.new @agents_count, limit, params['page'] || 1 @agents_pages = Paginator.new @agents_count, limit, params['page'] || 1
@offset ||= @agents_pages.offset @offset ||= @agents_pages.offset
@user_agents = paginateHelper @user_agents, limit @user_agents = paginateHelper @user_agents, limit
respond_to do |format|
format.html
format.xls{
time = Time.now.strftime("%Y%m%d")
filename = "引流情况#{time}.xls"
send_data(user_agents_export(), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename))
}
end
end end
# 实训课程等级体系 # 实训课程等级体系
@ -4369,6 +4378,39 @@ end
return sheet.rows return sheet.rows
end end
def user_agents_export
xls_report = StringIO.new
book = Spreadsheet::Workbook.new
sheet1 = book.create_worksheet :name => "引流名单"
blue = Spreadsheet::Format.new :color => :blue, :weight => :bold, :size => 10
sheet1.row(0).default_format = blue
count_row = 1
sheet1.row(0).concat(["序号", "LoginId", "姓名", "学校名称", "手机号", "邮箱", "参赛人数", "参赛队伍", "访问量"])
user_agents = UserAgent.where("user_agents.key is not null").pluck(:key).uniq
user_agents.each_with_index do |agent, index|
user = User.find_by_login(agent)
next if user.blank?
# 代理用户
agents = UserAgent.where(key: agent)
agents_count = agents.count
competion_users = agents.where(action_status: 2).pluck(:ip)
rank_user_id = UserActions.where(ip: competion_users).pluck(:user_id).uniq
team_ids = TeamMember.where(user_id: rank_user_id).pluck(:competition_team_id).uniq
sheet1[count_row, 0] = index + 1
sheet1[count_row, 1] = agent
sheet1[count_row, 2] = user.show_real_name
sheet1[count_row, 3] = user.school_name
sheet1[count_row, 4] = user.phone
sheet1[count_row, 5] = user.mail
sheet1[count_row, 6] = competion_users.count
sheet1[count_row, 7] = team_ids.count
sheet1[count_row, 8] = agents_count
count_row += 1
end
book.write xls_report
xls_report.string
end
def export_subject_level_system def export_subject_level_system
xls_report = StringIO.new xls_report = StringIO.new
book = Spreadsheet::Workbook.new book = Spreadsheet::Workbook.new

@ -28,7 +28,7 @@
<script> <script>
$(function(){ $(function(){
//初始化最热评测柱状图 //初始化最热评测柱状图
$.get('<%= student_hot_evaluations_college_path(@school) %>', function(data){ $.get('<%= student_hot_evaluations_college_path(@department.try(:identifier) || @school) %>', function(data){
InitHotEvaluating(data.names.reverse(), data.values.reverse()); InitHotEvaluating(data.names.reverse(), data.values.reverse());
}) })
}); });

@ -50,7 +50,7 @@
<div class="white-panel mb20 pl0 clearfix"> <div class="white-panel mb20 pl0 clearfix">
<li class="active" index="1"><a href="javascript:void(0);">课堂</a></li> <li class="active" index="1"><a href="javascript:void(0);">课堂</a></li>
<li index="2"><a href="<%= student_shixun_college_path(@school) %>" data-remote="true">学生实训</a></li> <li index="2"><a href="<%= student_shixun_college_path(@department.try(:identifier) || @school) %>" data-remote="true">学生实训</a></li>
<!--<li><a href="<%#= engineering_capability_college_path(@department) %>" data-remote="true">工程能力</a></li>--> <!--<li><a href="<%#= engineering_capability_college_path(@department) %>" data-remote="true">工程能力</a></li>-->
<!-- <li index="4"><a href="<%#= student_eval_college_path(@school) %>" data-remote="true">学生测评</a></li>--> <!-- <li index="4"><a href="<%#= student_eval_college_path(@school) %>" data-remote="true">学生测评</a></li>-->
</div> </div>
@ -139,15 +139,15 @@
}) })
}); });
$.get('<%= shixun_time_college_path(@school) %>', function(data){ $.get('<%= shixun_time_college_path(@department.try(:identifier) || @school) %>', function(data){
$('.shixun-time').html("<span data-tip-down=\"所有学员的实训耗时之和\">" + data.shixun_time + "</span>天"); $('.shixun-time').html("<span data-tip-down=\"所有学员的实训耗时之和\">" + data.shixun_time + "</span>天");
}); });
$.get('<%= shixun_report_count_college_path(@school) %>', function(data){ $.get('<%= shixun_report_count_college_path(@department.try(:identifier) || @school) %>', function(data){
$('.shixun-report-count').html("<span>" + data.shixun_report_count + "</span>个"); $('.shixun-report-count').html("<span>" + data.shixun_report_count + "</span>个");
}); });
// 教师排名 // 教师排名
$.ajax({ url: '<%= teachers_college_path(@school) %>', method: 'GET', dataType: 'script' }) $.ajax({ url: '<%= teachers_college_path(@department.try(:identifier) || @school) %>', method: 'GET', dataType: 'script' })
$(".count_student_test a").click(function(){ $(".count_student_test a").click(function(){
$(".count_student_test a").removeClass("active"); $(".count_student_test a").removeClass("active");
@ -155,7 +155,7 @@
}); });
//初始化饼状图 //初始化饼状图
$.get('<%= shixun_chart_data_college_path(@school) %>', function(data){ $.get('<%= shixun_chart_data_college_path(@department.try(:identifier) || @school) %>', function(data){
$('.pie-chart-loading').hide(); $('.pie-chart-loading').hide();
if (data.names.length > 0) { if (data.names.length > 0) {
$('.online_status .edu-tab-con-box').hide(); $('.online_status .edu-tab-con-box').hide();
@ -166,7 +166,7 @@
} }
}); });
$.get('<%= course_statistics_college_path(@school) %>'); $.get('<%= course_statistics_college_path(@department.try(:identifier) || @school) %>');
}); });
function InitPieChart(names, data){ function InitPieChart(names, data){
var Color = ['#49A9EE', '#FFD86E', '#98D87D', '#8996E6', '#F3857B', '#B97BF3','#4DE8B4','#F37BDB','#566EFF','#FF961A']; var Color = ['#49A9EE', '#FFD86E', '#98D87D', '#8996E6', '#F3857B', '#B97BF3','#4DE8B4','#F37BDB','#566EFF','#FF961A'];

@ -8,6 +8,7 @@
<th width="10%">竞赛报名状态</th> <th width="10%">竞赛报名状态</th>
<th width="10%">ip</th> <th width="10%">ip</th>
<th width="20%">负责人</th> <th width="20%">负责人</th>
<a href="<%= user_agents_managements_path(:format => "xls") %>" class="task-btn mr10 task-btn-orange fr">导出</a>
</thead> </thead>
<tbody> <tbody>
<% @user_agents.each do |ua| %> <% @user_agents.each do |ua| %>

Loading…
Cancel
Save