From ad61dc8ceeeb8db7fcdcb00a6bd135145b7fb5eb Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Wed, 13 Nov 2019 09:35:40 +0800
Subject: [PATCH 01/11] =?UTF-8?q?=E5=BC=95=E6=B5=81=E6=8A=A5500?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/managements_controller.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb
index 06a09f93..b19bbaf9 100644
--- a/app/controllers/managements_controller.rb
+++ b/app/controllers/managements_controller.rb
@@ -29,7 +29,7 @@ class ManagementsController < ApplicationController
end
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 by action_status, register_status")
@agents_count = @user_agents.count
limit = 20
@agents_pages = Paginator.new @agents_count, limit, params['page'] || 1
From bd32c34de9ebd5a70ea3ea5e497ad50a7e53327b Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Wed, 13 Nov 2019 09:46:20 +0800
Subject: [PATCH 02/11] =?UTF-8?q?=E5=BC=95=E6=B5=81=E6=8A=A5500?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/managements_controller.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb
index b19bbaf9..b90e9e76 100644
--- a/app/controllers/managements_controller.rb
+++ b/app/controllers/managements_controller.rb
@@ -29,7 +29,7 @@ class ManagementsController < ApplicationController
end
def user_agents
- @user_agents = UserAgent.where("user_agents.key is not null 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
limit = 20
@agents_pages = Paginator.new @agents_count, limit, params['page'] || 1
From 8ba524bd76c3d8282c82f07d4d85dcc4ccae1030 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Wed, 13 Nov 2019 11:46:32 +0800
Subject: [PATCH 03/11] =?UTF-8?q?=E5=BC=95=E6=B5=81=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/managements_controller.rb | 41 +++++++++++++++++++
.../managements/_user_agent_list.html.erb | 1 +
2 files changed, 42 insertions(+)
diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb
index b90e9e76..d04b4f23 100644
--- a/app/controllers/managements_controller.rb
+++ b/app/controllers/managements_controller.rb
@@ -35,6 +35,15 @@ class ManagementsController < ApplicationController
@agents_pages = Paginator.new @agents_count, limit, params['page'] || 1
@offset ||= @agents_pages.offset
@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
# 实训课程等级体系
@@ -4369,6 +4378,38 @@ end
return sheet.rows
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)
+ # 代理用户
+ agents = UserAgent.where(key: agent)
+ agents_count = agents.count
+ competion_users = agents.where(agent_type: UserAgent::USER_COMPETITION).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
xls_report = StringIO.new
book = Spreadsheet::Workbook.new
diff --git a/app/views/managements/_user_agent_list.html.erb b/app/views/managements/_user_agent_list.html.erb
index 6b47e51c..8c11a208 100644
--- a/app/views/managements/_user_agent_list.html.erb
+++ b/app/views/managements/_user_agent_list.html.erb
@@ -8,6 +8,7 @@
竞赛报名状态 |
ip |
负责人 |
+ " class="task-btn mr10 task-btn-orange fr">导出
<% @user_agents.each do |ua| %>
From 8788e8c11bb864f379aa6d3da0499448c224e84f Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Wed, 13 Nov 2019 11:55:00 +0800
Subject: [PATCH 04/11] =?UTF-8?q?=E7=94=A8=E6=88=B7=E4=B8=BA=E7=A9=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/managements_controller.rb | 1 +
1 file changed, 1 insertion(+)
diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb
index d04b4f23..2b73e7cc 100644
--- a/app/controllers/managements_controller.rb
+++ b/app/controllers/managements_controller.rb
@@ -4389,6 +4389,7 @@ end
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)
+ logger.info("###########user:#{agent}") if user.blank?
# 代理用户
agents = UserAgent.where(key: agent)
agents_count = agents.count
From b1a735c1ecd5f37924b8fc41bc6a732fa146fa4f Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Wed, 13 Nov 2019 11:56:11 +0800
Subject: [PATCH 05/11] =?UTF-8?q?=E7=94=A8=E6=88=B7=E4=B8=BA=E7=A9=BA?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/managements_controller.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb
index 2b73e7cc..e83993c4 100644
--- a/app/controllers/managements_controller.rb
+++ b/app/controllers/managements_controller.rb
@@ -4389,7 +4389,7 @@ end
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)
- logger.info("###########user:#{agent}") if user.blank?
+ next if user.blank?
# 代理用户
agents = UserAgent.where(key: agent)
agents_count = agents.count
From 4c8e1917ab65fcea0b6f82a30b57594a9bf27b73 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Wed, 13 Nov 2019 13:03:34 +0800
Subject: [PATCH 06/11] =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/colleges_controller.rb | 2 +-
app/views/colleges/statistics.html.erb | 10 +++++-----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/app/controllers/colleges_controller.rb b/app/controllers/colleges_controller.rb
index cc4e6c9a..93d2df8e 100644
--- a/app/controllers/colleges_controller.rb
+++ b/app/controllers/colleges_controller.rb
@@ -258,7 +258,7 @@ class CollegesController < ApplicationController
unless (User.current.admin? || User.current.business? ||
(@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) ||
- (@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
end
end
diff --git a/app/views/colleges/statistics.html.erb b/app/views/colleges/statistics.html.erb
index 8df81fcb..cc7ff4e6 100644
--- a/app/views/colleges/statistics.html.erb
+++ b/app/views/colleges/statistics.html.erb
@@ -139,15 +139,15 @@
})
});
- $.get('<%= shixun_time_college_path(@school) %>', function(data){
+ $.get('<%= shixun_time_college_path(@department.identifier) %>', function(data){
$('.shixun-time').html("" + data.shixun_time + "天");
});
- $.get('<%= shixun_report_count_college_path(@school) %>', function(data){
+ $.get('<%= shixun_report_count_college_path(@department.identifier) %>', function(data){
$('.shixun-report-count').html("" + data.shixun_report_count + "个");
});
// 教师排名
- $.ajax({ url: '<%= teachers_college_path(@school) %>', method: 'GET', dataType: 'script' })
+ $.ajax({ url: '<%= teachers_college_path(@department.identifier) %>', method: 'GET', dataType: 'script' })
$(".count_student_test a").click(function(){
$(".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.identifier) %>', function(data){
$('.pie-chart-loading').hide();
if (data.names.length > 0) {
$('.online_status .edu-tab-con-box').hide();
@@ -166,7 +166,7 @@
}
});
- $.get('<%= course_statistics_college_path(@school) %>');
+ $.get('<%= course_statistics_college_path(@department.identifier) %>');
});
function InitPieChart(names, data){
var Color = ['#49A9EE', '#FFD86E', '#98D87D', '#8996E6', '#F3857B', '#B97BF3','#4DE8B4','#F37BDB','#566EFF','#FF961A'];
From a09ef2965de173e2b7ef1ea39402be1f2b89d234 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Wed, 13 Nov 2019 13:59:46 +0800
Subject: [PATCH 07/11] =?UTF-8?q?=E5=BC=95=E6=B5=81=E5=8F=82=E8=B5=9B?=
=?UTF-8?q?=E4=BA=BA=E6=95=B0=E4=B8=8D=E5=AF=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/managements_controller.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb
index e83993c4..1c14e82e 100644
--- a/app/controllers/managements_controller.rb
+++ b/app/controllers/managements_controller.rb
@@ -4393,7 +4393,7 @@ end
# 代理用户
agents = UserAgent.where(key: agent)
agents_count = agents.count
- competion_users = agents.where(agent_type: UserAgent::USER_COMPETITION).pluck(:ip)
+ 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
From 4499081def233d5d96b6af1b141c0ec39221aaa9 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Wed, 13 Nov 2019 14:00:49 +0800
Subject: [PATCH 08/11] =?UTF-8?q?=E5=BC=95=E6=B5=81=E6=83=85=E5=86=B5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/managements_controller.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb
index 1c14e82e..884e32a8 100644
--- a/app/controllers/managements_controller.rb
+++ b/app/controllers/managements_controller.rb
@@ -39,7 +39,7 @@ class ManagementsController < ApplicationController
format.html
format.xls{
time = Time.now.strftime("%Y%m%d")
- filename = "实训课程体系#{time}.xls"
+ filename = "引流情况#{time}.xls"
send_data(user_agents_export(), :type => 'application/octet-stream', :filename => filename_for_content_disposition(filename))
}
end
From 223d2ad5b5a85af1b4b9feaebec68e342d1e96c7 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Wed, 13 Nov 2019 15:07:46 +0800
Subject: [PATCH 09/11] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E9=97=AE=E9=A2=98?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/colleges/statistics.html.erb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/views/colleges/statistics.html.erb b/app/views/colleges/statistics.html.erb
index cc7ff4e6..3a301077 100644
--- a/app/views/colleges/statistics.html.erb
+++ b/app/views/colleges/statistics.html.erb
@@ -50,7 +50,7 @@
From 923455f18468504581fb5ef9432ffa5a14268066 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Wed, 13 Nov 2019 15:18:41 +0800
Subject: [PATCH 10/11] =?UTF-8?q?=E9=AB=98=E6=A0=A1=E7=BB=9F=E8=AE=A1?=
=?UTF-8?q?=E9=A1=B5=E9=9D=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/colleges/_student_shixun.html.erb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/views/colleges/_student_shixun.html.erb b/app/views/colleges/_student_shixun.html.erb
index 44214bc6..88e8aa1a 100644
--- a/app/views/colleges/_student_shixun.html.erb
+++ b/app/views/colleges/_student_shixun.html.erb
@@ -28,7 +28,7 @@