From 6db6d8cd8d9cd18e64c3ca771a1e2816ad6aa4f7 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Mon, 27 May 2019 17:19:11 +0800 Subject: [PATCH 01/32] =?UTF-8?q?=E8=AF=84=E6=B5=8B=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E5=8F=96=E6=97=B6=E5=9C=A8=E4=B8=80=E5=A4=A9=E4=B9=8B=E5=86=85?= 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 851c50e6..202f90b3 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -853,7 +853,7 @@ class ManagementsController < ApplicationController def evaluate_simple page = params[:page] - @recodes = EvaluateRecord.where("created_at > ?", Time.now - 10000.days).reorder("consume_time desc") + @recodes = EvaluateRecord.where("created_at > ?", Time.now - 1.days).reorder("consume_time desc") @recodes_count = @recodes.size @record_pages = Paginator.new @recodes_count, 20, page || 1 @offset ||= @record_pages.offset From d48ec8974e2267d2e09c12028df046bcf59e9465 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 28 May 2019 08:58:43 +0800 Subject: [PATCH 02/32] =?UTF-8?q?=E5=AD=A6=E9=99=A2=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E7=9A=84=E8=AF=BE=E5=A0=82=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/colleges_controller.rb | 2 +- app/controllers/courses_controller.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/colleges_controller.rb b/app/controllers/colleges_controller.rb index fff508a8..1ffcdb46 100644 --- a/app/controllers/colleges_controller.rb +++ b/app/controllers/colleges_controller.rb @@ -131,7 +131,7 @@ class CollegesController < ApplicationController (select count(m.id) from messages m inner join boards b on b.id=m.board_id and b.parent_id=0 where b.course_id=c.id group by c.id) as messages_count, c.tea_id, c.name, c.is_end, (SELECT MAX(created_at) FROM `course_activities` ca WHERE ca.course_id = c.id) AS update_time - FROM `courses` c WHERE (c.school_id = #{@school.id} and c.is_delete = 0)") + FROM `courses` c join user_extensions ue on ue.user_id = c.tea_id WHERE (ue.school_id = #{@school.id} and c.is_delete = 0)") @courses.each do |course| course[:evaluating_count] = Output.find_by_sql("select sum(g.evaluate_count) as evaluating_count from games g inner join diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index e87c7297..669cc58f 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -577,7 +577,7 @@ class CoursesController < ApplicationController cha_member.member_roles.where("role_id = 10").first.destroy StudentsForCourse.where(:course_id => @course.id, :student_id => cha_member.user_id).destroy_all end - @course.update_attributes(:tea_id => cha_member.user_id) + @course.update_attributes(:tea_id => cha_member.user_id, :school_id => cha_member.user.try(:user_extensions).try(:school_id)) man_member.member_roles.first.update_attributes(:role_id => 9) course_act = CourseActivity.where(:course_id => @course.id, :course_act_id => @course.id, :course_act_type => 'Course').first course_act.update_column('user_id', cha_member.user_id) From f14bf75b307fb7f3ae90ea8d9c16f75f2789fb36 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 28 May 2019 09:15:13 +0800 Subject: [PATCH 03/32] =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/colleges_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/colleges_controller.rb b/app/controllers/colleges_controller.rb index 1ffcdb46..ad831e78 100644 --- a/app/controllers/colleges_controller.rb +++ b/app/controllers/colleges_controller.rb @@ -50,7 +50,8 @@ class CollegesController < ApplicationController # Redo:这样做内存会卡死的 # user_ids = User.find_by_sql("SELECT users.id FROM users LEFT JOIN user_extensions ON users.id=user_extensions.user_id WHERE user_extensions.`school_id` = #{@school.id}").map(&:id) # Redo:是否直接使用count会更好 - all_course_ids = Course.joins("join users u on courses.tea_id = u.id").joins("join user_extensions ue on u.id = ue.user_id").where("courses.id != 1309 and ue.school_id = #{@school.id}") + all_course_ids = Course.joins("join users u on courses.tea_id = u.id").joins("join user_extensions ue on u.id = ue.user_id"). + where("courses.id != 1309 and courses.is_delete = 0 and ue.school_id = #{@school.id}") @courses_count = all_course_ids.size # Redo:对于量比较大的尽量不使用笛卡尔积 From 00e4170593e53843aeed2f91dfa49fd2aa4fd6d4 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 28 May 2019 09:46:58 +0800 Subject: [PATCH 04/32] =?UTF-8?q?=E8=AF=BE=E5=A0=82=E7=9A=84school=5Fid?= =?UTF-8?q?=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/colleges_controller.rb | 5 ++--- db/migrate/20190528013018_migrate_course_school_id.rb | 11 +++++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 db/migrate/20190528013018_migrate_course_school_id.rb diff --git a/app/controllers/colleges_controller.rb b/app/controllers/colleges_controller.rb index ad831e78..418015fd 100644 --- a/app/controllers/colleges_controller.rb +++ b/app/controllers/colleges_controller.rb @@ -50,8 +50,7 @@ class CollegesController < ApplicationController # Redo:这样做内存会卡死的 # user_ids = User.find_by_sql("SELECT users.id FROM users LEFT JOIN user_extensions ON users.id=user_extensions.user_id WHERE user_extensions.`school_id` = #{@school.id}").map(&:id) # Redo:是否直接使用count会更好 - all_course_ids = Course.joins("join users u on courses.tea_id = u.id").joins("join user_extensions ue on u.id = ue.user_id"). - where("courses.id != 1309 and courses.is_delete = 0 and ue.school_id = #{@school.id}") + all_course_ids = Course.where("id != 1309 and is_delete = 0 and school_id = #{@school.id}") @courses_count = all_course_ids.size # Redo:对于量比较大的尽量不使用笛卡尔积 @@ -132,7 +131,7 @@ class CollegesController < ApplicationController (select count(m.id) from messages m inner join boards b on b.id=m.board_id and b.parent_id=0 where b.course_id=c.id group by c.id) as messages_count, c.tea_id, c.name, c.is_end, (SELECT MAX(created_at) FROM `course_activities` ca WHERE ca.course_id = c.id) AS update_time - FROM `courses` c join user_extensions ue on ue.user_id = c.tea_id WHERE (ue.school_id = #{@school.id} and c.is_delete = 0)") + FROM `courses` c WHERE c.school_id = #{@school.id} and c.is_delete = 0") @courses.each do |course| course[:evaluating_count] = Output.find_by_sql("select sum(g.evaluate_count) as evaluating_count from games g inner join diff --git a/db/migrate/20190528013018_migrate_course_school_id.rb b/db/migrate/20190528013018_migrate_course_school_id.rb new file mode 100644 index 00000000..b0669591 --- /dev/null +++ b/db/migrate/20190528013018_migrate_course_school_id.rb @@ -0,0 +1,11 @@ +class MigrateCourseSchoolId < ActiveRecord::Migration + def up + courses = Course.includes(teacher: :user_extensions).where("courses.school_id != user_extensions.school_id or courses.school_id is null") + courses.each do |course| + course.update_column('school_id', course.teacher.try(:user_extensions).try(:school_id)) + end + end + + def down + end +end From 2f9fb67479a4537a2e861a6b67426e60e4bdb200 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Tue, 28 May 2019 15:10:51 +0800 Subject: [PATCH 05/32] =?UTF-8?q?sonar=E8=AF=84=E6=B5=8B=E5=8F=96=E6=9C=80?= =?UTF-8?q?=E5=90=8E=E4=B8=80=E4=B8=AA=E9=99=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 1afaefc3..89fddb36 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -647,7 +647,7 @@ class StudentWorkController < ApplicationController uid: "#{work.user.user_extensions.student_id}", downloadUrl: '' } - attachment = work.attachments.first + attachment = work.attachments.last if attachment o[:downloadUrl] = "https://#{Setting.host_name}/"+download_named_attachment_path(attachment.id, attachment.filename) end From 8a24cf69dee01584eb30d2b42e17c00e7197cfae Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 29 May 2019 16:30:22 +0800 Subject: [PATCH 06/32] 1 --- app/services/games_service.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/services/games_service.rb b/app/services/games_service.rb index e413c101..9e1ea356 100644 --- a/app/services/games_service.rb +++ b/app/services/games_service.rb @@ -19,6 +19,7 @@ class GamesService shixun = Shixun.min.find(myshixun.shixun_id) unless ((myshixun.user_id == current_user.id || current_user.business? || current_user.id == shixun.try(:user_id) || current_user.is_certification_teacher) && (shixun.operable?)) || current_user.admin? + Rails.logger.info("######403???") return{:status => 403} end game_challenge = Challenge.min.find(game.challenge_id) From 4a42989a33f1b26fbaf47e9fa66afb565936e67c Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 29 May 2019 16:45:52 +0800 Subject: [PATCH 07/32] 1 --- app/api/mobile/api.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/api/mobile/api.rb b/app/api/mobile/api.rb index 69bd4d44..0be7d4b2 100644 --- a/app/api/mobile/api.rb +++ b/app/api/mobile/api.rb @@ -110,6 +110,7 @@ module Mobile end third_party_user_id = session[:third_party_user_id] + Rails.logger.info("#########third_party_user_id: #{third_party_user_id}") if third_party_user_id c_user = UserSource.find_by_id(session[:third_party_user_id]) return c_user.user if c_user From 833a99dfb65560b6e3a8ffa6eecf4d3b20b50262 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 29 May 2019 16:50:14 +0800 Subject: [PATCH 08/32] 1 --- app/api/mobile/api.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/api/mobile/api.rb b/app/api/mobile/api.rb index 0be7d4b2..bce3f24f 100644 --- a/app/api/mobile/api.rb +++ b/app/api/mobile/api.rb @@ -34,7 +34,7 @@ module Mobile version 'v1', using: :path format :json content_type :json, "application/json;charset=UTF-8" - use ActionDispatch::Session::CookieStore + use ActionDispatch::Session::CookieStore, key: '_educoder_session' require 'digest' use Mobile::Middleware::ErrorHandler From 51e4759bcc04a80b1b0cc28bfc5bda7a8d149001 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 29 May 2019 17:00:14 +0800 Subject: [PATCH 09/32] 1 --- app/services/cnmoocs_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/cnmoocs_service.rb b/app/services/cnmoocs_service.rb index 9ec02bfd..3161eeac 100644 --- a/app/services/cnmoocs_service.rb +++ b/app/services/cnmoocs_service.rb @@ -115,7 +115,7 @@ class CnmoocsService end def source_url(params) - shixun = Shixun.find_by_identifier(params[:resouceId]) + shixun = Shixun.find_by_id(params[:resouceId]) if shixun.blank? return { error: -1, messages: '资源不存在' } end From c6f4da31879350a1c58c34a11270b3ee9c0700d4 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 29 May 2019 17:07:59 +0800 Subject: [PATCH 10/32] 1 --- app/api/mobile/api.rb | 2 +- app/api/mobile/apis/cnmooc.rb | 4 +++- app/controllers/account_controller.rb | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app/api/mobile/api.rb b/app/api/mobile/api.rb index bce3f24f..0be7d4b2 100644 --- a/app/api/mobile/api.rb +++ b/app/api/mobile/api.rb @@ -34,7 +34,7 @@ module Mobile version 'v1', using: :path format :json content_type :json, "application/json;charset=UTF-8" - use ActionDispatch::Session::CookieStore, key: '_educoder_session' + use ActionDispatch::Session::CookieStore require 'digest' use Mobile::Middleware::ErrorHandler diff --git a/app/api/mobile/apis/cnmooc.rb b/app/api/mobile/apis/cnmooc.rb index d67a390d..06467765 100644 --- a/app/api/mobile/apis/cnmooc.rb +++ b/app/api/mobile/apis/cnmooc.rb @@ -43,11 +43,13 @@ module Mobile requires :accessType, type: Integer, desc: "资源类型" end get "source_url" do + if session[:third_party_user_id].blank? user = User.find(params[:userId]) session[:third_party_user_id] = user.user_source.id + #self.logged_user = user end - + Rails.logger.info("####session: #{session}") CnmoocsService.new.source_url(params) end diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 60096a22..6409114f 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -293,6 +293,7 @@ class AccountController < ApplicationController UserActions.create(:action_id => User.current.id, :action_type => "Logout", :user_id => User.current.id) logout_user # 记录用户登出行为 + logger.info("#########logout_session: #{session}") redirect_to home_path end # display the logout form From c3c0b8db98e8b3d2b3c47a89452f10ba7156b9d4 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 29 May 2019 17:17:53 +0800 Subject: [PATCH 11/32] 1 --- app/api/mobile/apis/cnmooc.rb | 7 ------- app/services/cnmoocs_service.rb | 3 +++ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/app/api/mobile/apis/cnmooc.rb b/app/api/mobile/apis/cnmooc.rb index 06467765..96b10101 100644 --- a/app/api/mobile/apis/cnmooc.rb +++ b/app/api/mobile/apis/cnmooc.rb @@ -43,13 +43,6 @@ module Mobile requires :accessType, type: Integer, desc: "资源类型" end get "source_url" do - - if session[:third_party_user_id].blank? - user = User.find(params[:userId]) - session[:third_party_user_id] = user.user_source.id - #self.logged_user = user - end - Rails.logger.info("####session: #{session}") CnmoocsService.new.source_url(params) end diff --git a/app/services/cnmoocs_service.rb b/app/services/cnmoocs_service.rb index 3161eeac..dd07cd57 100644 --- a/app/services/cnmoocs_service.rb +++ b/app/services/cnmoocs_service.rb @@ -115,6 +115,9 @@ class CnmoocsService end def source_url(params) + user_source = UserSource.find_by_user_id(params[:userId]) + return {error: -1, messages: "用户不存在,请先创建用户"} if user_source + self.logged_user = user_source.user shixun = Shixun.find_by_id(params[:resouceId]) if shixun.blank? return { error: -1, messages: '资源不存在' } From d99036f918de9db8b5c3a18a248493ba6c3d9770 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 29 May 2019 17:19:57 +0800 Subject: [PATCH 12/32] 1 --- app/controllers/application_controller.rb | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 42dd6e1e..435c71fc 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -207,9 +207,6 @@ class ApplicationController < ActionController::Base elsif session[:wechat_openid] uw = UserWechat.find_by_openid(session[:wechat_openid]) user = uw.user if uw - elsif session[:third_party_user_id] - c_user = UserSource.find_by_id(session[:third_party_user_id]) - user = c_user.user if c_user end end if user.nil? && Setting.rest_api_enabled? && accept_api_auth? From b13bf24330bb323ae9c72e737262f5c95121469d Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 29 May 2019 17:20:53 +0800 Subject: [PATCH 13/32] 1 --- app/api/mobile/api.rb | 8 -------- 1 file changed, 8 deletions(-) diff --git a/app/api/mobile/api.rb b/app/api/mobile/api.rb index 0be7d4b2..a0004c3c 100644 --- a/app/api/mobile/api.rb +++ b/app/api/mobile/api.rb @@ -108,14 +108,6 @@ module Mobile uw = UserWechat.find_by_openid(openid) return uw.user if uw end - - third_party_user_id = session[:third_party_user_id] - Rails.logger.info("#########third_party_user_id: #{third_party_user_id}") - if third_party_user_id - c_user = UserSource.find_by_id(session[:third_party_user_id]) - return c_user.user if c_user - end - token = ApiKey.where(access_token: params[:token]).first if token && !token.expired? return User.find(token.user_id) From 582e0b19c61c9386d540aa4f98fd4d59745c8fe5 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 29 May 2019 17:23:16 +0800 Subject: [PATCH 14/32] 1 --- app/services/cnmoocs_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/services/cnmoocs_service.rb b/app/services/cnmoocs_service.rb index dd07cd57..24a9950e 100644 --- a/app/services/cnmoocs_service.rb +++ b/app/services/cnmoocs_service.rb @@ -116,7 +116,7 @@ class CnmoocsService def source_url(params) user_source = UserSource.find_by_user_id(params[:userId]) - return {error: -1, messages: "用户不存在,请先创建用户"} if user_source + return {error: -1, messages: "用户不存在,请先创建用户"} if user_source.blank? self.logged_user = user_source.user shixun = Shixun.find_by_id(params[:resouceId]) if shixun.blank? From 2a3bbc290961517912dfc905d73503bc68ad5ad7 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 29 May 2019 17:24:53 +0800 Subject: [PATCH 15/32] 1 --- app/api/mobile/apis/cnmooc.rb | 3 +++ app/services/cnmoocs_service.rb | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/api/mobile/apis/cnmooc.rb b/app/api/mobile/apis/cnmooc.rb index 96b10101..7546fd58 100644 --- a/app/api/mobile/apis/cnmooc.rb +++ b/app/api/mobile/apis/cnmooc.rb @@ -43,6 +43,9 @@ module Mobile requires :accessType, type: Integer, desc: "资源类型" end get "source_url" do + user_source = UserSource.find_by_user_id(params[:userId]) + return {error: -1, messages: "用户不存在,请先创建用户"} if user_source.blank? + self.logged_user = user_source.user CnmoocsService.new.source_url(params) end diff --git a/app/services/cnmoocs_service.rb b/app/services/cnmoocs_service.rb index 24a9950e..3161eeac 100644 --- a/app/services/cnmoocs_service.rb +++ b/app/services/cnmoocs_service.rb @@ -115,9 +115,6 @@ class CnmoocsService end def source_url(params) - user_source = UserSource.find_by_user_id(params[:userId]) - return {error: -1, messages: "用户不存在,请先创建用户"} if user_source.blank? - self.logged_user = user_source.user shixun = Shixun.find_by_id(params[:resouceId]) if shixun.blank? return { error: -1, messages: '资源不存在' } From 6ecea79dc3f50ea778b995363f7a2bf78cbc5b3c Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 29 May 2019 17:28:00 +0800 Subject: [PATCH 16/32] 1 --- app/api/mobile/apis/cnmooc.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/api/mobile/apis/cnmooc.rb b/app/api/mobile/apis/cnmooc.rb index 7546fd58..720ac26b 100644 --- a/app/api/mobile/apis/cnmooc.rb +++ b/app/api/mobile/apis/cnmooc.rb @@ -43,9 +43,11 @@ module Mobile requires :accessType, type: Integer, desc: "资源类型" end get "source_url" do - user_source = UserSource.find_by_user_id(params[:userId]) - return {error: -1, messages: "用户不存在,请先创建用户"} if user_source.blank? - self.logged_user = user_source.user + if session[:user_id].blank? + user = User.find(params[:userId]) + return { error: -1, messages: "用户不存在,请先创建用户" } unless user.user_source + session[:user_id] = user.user_source.id + end CnmoocsService.new.source_url(params) end From d36972bec91ae67fcc69b8ff39741f5ec68e3333 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 29 May 2019 17:29:02 +0800 Subject: [PATCH 17/32] 1 --- app/api/mobile/apis/cnmooc.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/api/mobile/apis/cnmooc.rb b/app/api/mobile/apis/cnmooc.rb index 720ac26b..2d1f41b3 100644 --- a/app/api/mobile/apis/cnmooc.rb +++ b/app/api/mobile/apis/cnmooc.rb @@ -46,7 +46,7 @@ module Mobile if session[:user_id].blank? user = User.find(params[:userId]) return { error: -1, messages: "用户不存在,请先创建用户" } unless user.user_source - session[:user_id] = user.user_source.id + session[:user_id] = user.id end CnmoocsService.new.source_url(params) end From 46e1c04e016e2dac368944d61b1ddd733db6811d Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 29 May 2019 17:34:42 +0800 Subject: [PATCH 18/32] 1 --- app/api/mobile/api.rb | 8 ++++++++ app/api/mobile/apis/cnmooc.rb | 5 ++--- app/controllers/account_controller.rb | 1 - app/controllers/application_controller.rb | 4 ++++ 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/app/api/mobile/api.rb b/app/api/mobile/api.rb index a0004c3c..0be7d4b2 100644 --- a/app/api/mobile/api.rb +++ b/app/api/mobile/api.rb @@ -108,6 +108,14 @@ module Mobile uw = UserWechat.find_by_openid(openid) return uw.user if uw end + + third_party_user_id = session[:third_party_user_id] + Rails.logger.info("#########third_party_user_id: #{third_party_user_id}") + if third_party_user_id + c_user = UserSource.find_by_id(session[:third_party_user_id]) + return c_user.user if c_user + end + token = ApiKey.where(access_token: params[:token]).first if token && !token.expired? return User.find(token.user_id) diff --git a/app/api/mobile/apis/cnmooc.rb b/app/api/mobile/apis/cnmooc.rb index 2d1f41b3..b813d559 100644 --- a/app/api/mobile/apis/cnmooc.rb +++ b/app/api/mobile/apis/cnmooc.rb @@ -43,10 +43,9 @@ module Mobile requires :accessType, type: Integer, desc: "资源类型" end get "source_url" do - if session[:user_id].blank? + if session[:third_party_user_id].blank? user = User.find(params[:userId]) - return { error: -1, messages: "用户不存在,请先创建用户" } unless user.user_source - session[:user_id] = user.id + session[:third_party_user_id] = user.user_source.id end CnmoocsService.new.source_url(params) end diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 6409114f..60096a22 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -293,7 +293,6 @@ class AccountController < ApplicationController UserActions.create(:action_id => User.current.id, :action_type => "Logout", :user_id => User.current.id) logout_user # 记录用户登出行为 - logger.info("#########logout_session: #{session}") redirect_to home_path end # display the logout form diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 435c71fc..d1b7d21a 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -207,6 +207,9 @@ class ApplicationController < ActionController::Base elsif session[:wechat_openid] uw = UserWechat.find_by_openid(session[:wechat_openid]) user = uw.user if uw + elsif session[:third_party_user_id] + c_user = UserSource.find_by_id(session[:third_party_user_id]) + user = c_user.user if c_user end end if user.nil? && Setting.rest_api_enabled? && accept_api_auth? @@ -300,6 +303,7 @@ class ApplicationController < ActionController::Base end # Token.delete_all(["user_id = ? AND action = ?", User.current.id, 'autologin']) self.logged_user = nil + session[:third_party_user_id] = nil end end From 7e87cd2f822f0f8bfb1b6704f18146c24a764896 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Wed, 29 May 2019 20:34:07 +0800 Subject: [PATCH 19/32] vnc --- app/models/shixun.rb | 2 +- app/views/shixuns/_form.html.erb | 2 +- app/views/shixuns/_settings_edit.html.erb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/models/shixun.rb b/app/models/shixun.rb index 439c0e44..bf06b583 100644 --- a/app/models/shixun.rb +++ b/app/models/shixun.rb @@ -57,7 +57,7 @@ class Shixun < ActiveRecord::Base scope :visible, lambda{where(status: [2,3])} scope :min, lambda { select([:id, :name, :gpid, :modify_time, :reset_time, :language, :propaedeutics, :status, :identifier, :test_set_permission, :hide_code, :forbid_copy, :hidden, :webssh, :user_id, :code_hidden, - :task_pass, :exec_time, :multi_webssh]) } + :task_pass, :exec_time, :multi_webssh, :vnc]) } scope :published, lambda{where(status: 2)} scope :field_for_recommend, lambda{ select([:id, :name, :identifier, :myshixuns_count]) } diff --git a/app/views/shixuns/_form.html.erb b/app/views/shixuns/_form.html.erb index 53d38a63..337ecee2 100644 --- a/app/views/shixuns/_form.html.erb +++ b/app/views/shixuns/_form.html.erb @@ -156,7 +156,7 @@ - <% if Redmine::Configuration['gitlab_address'].include?("test") %> + <% if User.current.admin? %>

VNC图形化

  • diff --git a/app/views/shixuns/_settings_edit.html.erb b/app/views/shixuns/_settings_edit.html.erb index 6ebbf633..6ebd6138 100644 --- a/app/views/shixuns/_settings_edit.html.erb +++ b/app/views/shixuns/_settings_edit.html.erb @@ -211,7 +211,7 @@
  • - <% if Redmine::Configuration['gitlab_address'].include?("test") %> + <% if User.current.admin? %>
    VNC图形化: From 2c980c14f5c59bcb9313b0f3406118a6e5073a9c Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 29 May 2019 21:54:33 +0800 Subject: [PATCH 20/32] 1 --- app/api/mobile/api.rb | 12 ++++++------ app/api/mobile/apis/cnmooc.rb | 4 ---- app/controllers/application_controller.rb | 6 +++--- app/services/cnmoocs_service.rb | 5 +++-- 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/app/api/mobile/api.rb b/app/api/mobile/api.rb index 0be7d4b2..6085d00f 100644 --- a/app/api/mobile/api.rb +++ b/app/api/mobile/api.rb @@ -109,12 +109,12 @@ module Mobile return uw.user if uw end - third_party_user_id = session[:third_party_user_id] - Rails.logger.info("#########third_party_user_id: #{third_party_user_id}") - if third_party_user_id - c_user = UserSource.find_by_id(session[:third_party_user_id]) - return c_user.user if c_user - end + # third_party_user_id = session[:third_party_user_id] + # Rails.logger.info("#########third_party_user_id: #{third_party_user_id}") + # if third_party_user_id + # c_user = UserSource.find_by_id(session[:third_party_user_id]) + # return c_user.user if c_user + # end token = ApiKey.where(access_token: params[:token]).first if token && !token.expired? diff --git a/app/api/mobile/apis/cnmooc.rb b/app/api/mobile/apis/cnmooc.rb index b813d559..96b10101 100644 --- a/app/api/mobile/apis/cnmooc.rb +++ b/app/api/mobile/apis/cnmooc.rb @@ -43,10 +43,6 @@ module Mobile requires :accessType, type: Integer, desc: "资源类型" end get "source_url" do - if session[:third_party_user_id].blank? - user = User.find(params[:userId]) - session[:third_party_user_id] = user.user_source.id - end CnmoocsService.new.source_url(params) end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index d1b7d21a..9018cc6c 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -207,9 +207,9 @@ class ApplicationController < ActionController::Base elsif session[:wechat_openid] uw = UserWechat.find_by_openid(session[:wechat_openid]) user = uw.user if uw - elsif session[:third_party_user_id] - c_user = UserSource.find_by_id(session[:third_party_user_id]) - user = c_user.user if c_user + elsif params[:authToken] + user = Token.find_by_value(params[:authToken]).user + session[:user_id] = user.id end end if user.nil? && Setting.rest_api_enabled? && accept_api_auth? diff --git a/app/services/cnmoocs_service.rb b/app/services/cnmoocs_service.rb index 3161eeac..6de07203 100644 --- a/app/services/cnmoocs_service.rb +++ b/app/services/cnmoocs_service.rb @@ -115,12 +115,13 @@ class CnmoocsService end def source_url(params) + user = User.find_by_id(params[:userId]) + token = Token.get_or_create_permanent_login_token(user) shixun = Shixun.find_by_id(params[:resouceId]) if shixun.blank? return { error: -1, messages: '资源不存在' } end - - { error: 0, messages: '成功', accessUrl: "#{Redmine::Configuration['educoder_domain']}/shixuns/#{shixun.identifier}" } + { error: 0, messages: '成功', accessUrl: "#{Redmine::Configuration['educoder_domain']}/shixuns/#{shixun.identifier}/challenges?authToken=#{token.value}" } end def get_students_data params From ba6df7b9b1d8667da30586ea46d469a2a49adc56 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 29 May 2019 22:00:44 +0800 Subject: [PATCH 21/32] 1 --- app/controllers/application_controller.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 9018cc6c..e6240714 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -193,6 +193,21 @@ class ApplicationController < ActionController::Base find_current_user end + def set_autologin_cookie(user) + token = Token.get_or_create_permanent_login_token(user) + cookie_options = { + :value => token.value, + :expires => 1.month.from_now, + :path => (Redmine::Configuration['autologin_cookie_path'] || '/'), + :secure => (Redmine::Configuration['autologin_cookie_secure'] ? true : false), + :httponly => true + } + if Redmine::Configuration['cookie_domain'].present? + cookie_options = cookie_options.merge(domain: Redmine::Configuration['cookie_domain']) + end + cookies[autologin_cookie_name] = cookie_options + end + def find_current_user user = nil unless api_request? @@ -209,6 +224,7 @@ class ApplicationController < ActionController::Base user = uw.user if uw elsif params[:authToken] user = Token.find_by_value(params[:authToken]).user + set_autologin_cookie(user) session[:user_id] = user.id end end From 99511fe5e6e09614ac88d7edbc0d1d0ee9f750a9 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 29 May 2019 22:14:43 +0800 Subject: [PATCH 22/32] 1 --- app/controllers/application_controller.rb | 1 - app/services/cnmoocs_service.rb | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index e6240714..535a75b6 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -319,7 +319,6 @@ class ApplicationController < ActionController::Base end # Token.delete_all(["user_id = ? AND action = ?", User.current.id, 'autologin']) self.logged_user = nil - session[:third_party_user_id] = nil end end diff --git a/app/services/cnmoocs_service.rb b/app/services/cnmoocs_service.rb index 6de07203..fa6e67ea 100644 --- a/app/services/cnmoocs_service.rb +++ b/app/services/cnmoocs_service.rb @@ -116,6 +116,7 @@ class CnmoocsService def source_url(params) user = User.find_by_id(params[:userId]) + return {error: -1, messages: "用户不存在,请先创建用户"} unless user token = Token.get_or_create_permanent_login_token(user) shixun = Shixun.find_by_id(params[:resouceId]) if shixun.blank? From 151ab55dbb15a6bbdc323990f1a4b0d925322d50 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 29 May 2019 22:24:22 +0800 Subject: [PATCH 23/32] 1 --- app/controllers/application_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 535a75b6..dd1f5967 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -225,7 +225,7 @@ class ApplicationController < ActionController::Base elsif params[:authToken] user = Token.find_by_value(params[:authToken]).user set_autologin_cookie(user) - session[:user_id] = user.id + start_user_session(user) end end if user.nil? && Setting.rest_api_enabled? && accept_api_auth? From 2df0d65ce7f9ff7ad7c06bc7f89a329611b01127 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 29 May 2019 23:44:00 +0800 Subject: [PATCH 24/32] 1 --- app/api/mobile/apis/cnmooc.rb | 16 +++++++++++++++- app/controllers/application_controller.rb | 5 +++-- app/controllers/challenges_controller.rb | 9 +++++++++ app/services/cnmoocs_service.rb | 5 +---- 4 files changed, 28 insertions(+), 7 deletions(-) diff --git a/app/api/mobile/apis/cnmooc.rb b/app/api/mobile/apis/cnmooc.rb index 96b10101..7745cf8e 100644 --- a/app/api/mobile/apis/cnmooc.rb +++ b/app/api/mobile/apis/cnmooc.rb @@ -43,7 +43,21 @@ module Mobile requires :accessType, type: Integer, desc: "资源类型" end get "source_url" do - CnmoocsService.new.source_url(params) + user = User.find_by_id(params[:userId]) + return {error: -1, messages: "用户不存在,请先创建用户"} unless user + token = Token.get_or_create_permanent_login_token(user) + cookie_options = { + :value => token.value, + :expires => 1.month.from_now, + :path => (Redmine::Configuration['autologin_cookie_path'] || '/'), + :secure => (Redmine::Configuration['autologin_cookie_secure'] ? true : false), + :httponly => true + } + if Redmine::Configuration['cookie_domain'].present? + cookie_options = cookie_options.merge(domain: Redmine::Configuration['cookie_domain']) + end + cookies[Redmine::Configuration['autologin_cookie_name'].presence || 'autologin'] = cookie_options + CnmoocsService.new.source_url(params, token) end desc "远程登录" diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index dd1f5967..4185e367 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -224,8 +224,9 @@ class ApplicationController < ActionController::Base user = uw.user if uw elsif params[:authToken] user = Token.find_by_value(params[:authToken]).user - set_autologin_cookie(user) - start_user_session(user) + #set_autologin_cookie(user) + #start_user_session(user) + session[:user_id] = user.id end end if user.nil? && Setting.rest_api_enabled? && accept_api_auth? diff --git a/app/controllers/challenges_controller.rb b/app/controllers/challenges_controller.rb index bf01ffb0..3322f1f2 100644 --- a/app/controllers/challenges_controller.rb +++ b/app/controllers/challenges_controller.rb @@ -16,6 +16,7 @@ class ChallengesController < ApplicationController #before_filter :find_shixun_language, :only => [:show, :new, :edit] before_filter :base_index, :only => [:index, :index_down, :index_up, :destroy] before_filter :view_allow, :only => [:show] + # before_filter :check_cnmooc, :only => [:index] include ApplicationHelper @@ -487,4 +488,12 @@ class ChallengesController < ApplicationController response.headers['content--type'] = 'text/javascript' request.format = 'js' end + + # def check_cnmooc + # if params[:authToken] + # user = User.find_by_id(session[:user_id]) + # set_autologin_cookie(user) + # end + # end + end diff --git a/app/services/cnmoocs_service.rb b/app/services/cnmoocs_service.rb index fa6e67ea..41705eb6 100644 --- a/app/services/cnmoocs_service.rb +++ b/app/services/cnmoocs_service.rb @@ -114,10 +114,7 @@ class CnmoocsService end - def source_url(params) - user = User.find_by_id(params[:userId]) - return {error: -1, messages: "用户不存在,请先创建用户"} unless user - token = Token.get_or_create_permanent_login_token(user) + def source_url(params, token) shixun = Shixun.find_by_id(params[:resouceId]) if shixun.blank? return { error: -1, messages: '资源不存在' } From 9c01b6ff77b0ab90ea54b62a4060db548226509e Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Thu, 30 May 2019 08:46:30 +0800 Subject: [PATCH 25/32] =?UTF-8?q?vnc=E5=9C=A8gameshow=E4=B8=AD=E8=BF=94?= =?UTF-8?q?=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/services/games_service.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/services/games_service.rb b/app/services/games_service.rb index 9e1ea356..a53ee086 100644 --- a/app/services/games_service.rb +++ b/app/services/games_service.rb @@ -75,7 +75,8 @@ class GamesService :challenge => game_challenge.try(:attributes), :game => game.try(:attributes), :shixun => shixun.try(:attributes), :record => record, :grade => grade, :prev_game => prev_game, :next_game => next_game, :username => username, :image_url => image_url, :user_url => user_url, :praise_count => praise_count, :user_praise => user_praise, :time_limit => time_limit, - :tomcat_url => Redmine::Configuration['tomcat_php'], :is_teacher => is_teacher, :power => power, :myshixun_manager => myshixun_manager} + :tomcat_url => Redmine::Configuration['tomcat_php'], :is_teacher => is_teacher, :power => power, :myshixun_manager => myshixun_manager, + :vnc => shixun.vnc} # 区分选择题和编程题,st:0编程题; if st == 0 From 048c8571bcdae20221a5fac7c7e003f35c4166ca Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Thu, 30 May 2019 08:57:33 +0800 Subject: [PATCH 26/32] vnc.. --- app/controllers/myshixuns_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb index f6854c7a..d95cdc96 100644 --- a/app/controllers/myshixuns_controller.rb +++ b/app/controllers/myshixuns_controller.rb @@ -1,7 +1,7 @@ # encoding: utf-8 class MyshixunsController < ApplicationController layout 'base_myshixun' - skip_before_filter :verify_authenticity_token, :only => [:training_task_status, :close_webssh, :code_runinng_message] + skip_before_filter :verify_authenticity_token, :only => [:training_task_status, :close_webssh, :code_runinng_message, :vnc] before_filter :require_login, :except => [:training_task_status, :close_webssh, :code_runinng_message] before_filter :check_authentication, :except => [:training_task_status, :close_webssh, :mul_test_home, :mul_test_user, :mul_test_myshixun, :mul_test_shixun, :mul_test_start, :code_runinng_message] From 8a45a61ef89cbc78e8b59ff6d1b31e3836db0d80 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Thu, 30 May 2019 08:59:35 +0800 Subject: [PATCH 27/32] =?UTF-8?q?vnc=E5=85=8D=E7=99=BB=E9=99=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/myshixuns_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb index d95cdc96..add6511c 100644 --- a/app/controllers/myshixuns_controller.rb +++ b/app/controllers/myshixuns_controller.rb @@ -2,7 +2,7 @@ class MyshixunsController < ApplicationController layout 'base_myshixun' skip_before_filter :verify_authenticity_token, :only => [:training_task_status, :close_webssh, :code_runinng_message, :vnc] - before_filter :require_login, :except => [:training_task_status, :close_webssh, :code_runinng_message] + before_filter :require_login, :except => [:training_task_status, :close_webssh, :code_runinng_message, :vnc] before_filter :check_authentication, :except => [:training_task_status, :close_webssh, :mul_test_home, :mul_test_user, :mul_test_myshixun, :mul_test_shixun, :mul_test_start, :code_runinng_message] before_filter :find_myshixun, :only => [:show, :myshixun_reset, :open_webssh, :sync_reset_time, :destroy, :search_file_list, :vnc] From eddd5e6144a3206648d6dbbdd288ba8c6a3d39ed Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 30 May 2019 09:57:21 +0800 Subject: [PATCH 28/32] 1 --- app/controllers/application_controller.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 4185e367..e44005a4 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -352,6 +352,8 @@ class ApplicationController < ActionController::Base end def require_login + logger.info("#########login?: #{User.current.logged?}") + logger.info("#########get?: #{request.get?}") if !User.current.logged? # Extract only the basic url parameters on non-GET requests if request.get? From 972ad7551868f0f31522b51156407b55b3e90bdf Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Thu, 30 May 2019 09:58:21 +0800 Subject: [PATCH 29/32] =?UTF-8?q?vnc=E6=B7=BB=E5=8A=A0containers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/myshixuns_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb index add6511c..1029c37d 100644 --- a/app/controllers/myshixuns_controller.rb +++ b/app/controllers/myshixuns_controller.rb @@ -357,7 +357,8 @@ class MyshixunsController < ApplicationController host = Redmine::Configuration['tomcat_php'] begin uri = "#{shixun_tomcat}/bridge/vnc/getvnc" - params = {tpiID:@myshixun.id} + shixun = myshixun.shixun + params = {tpiID: @myshixun.id, :containers => "#{Base64.urlsafe_encode64(container_limit(shixun.mirror_repositories))}"} res = uri_exec uri, params if res && res['code'].to_i != 0 raise("实训云平台繁忙(繁忙等级:99)") From 0ddf6a7efda6b9edf40abc7e0f118cfa3e466ee6 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Thu, 30 May 2019 10:01:53 +0800 Subject: [PATCH 30/32] =?UTF-8?q?vnc=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/myshixuns_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb index 1029c37d..e9f412ab 100644 --- a/app/controllers/myshixuns_controller.rb +++ b/app/controllers/myshixuns_controller.rb @@ -4,7 +4,7 @@ class MyshixunsController < ApplicationController skip_before_filter :verify_authenticity_token, :only => [:training_task_status, :close_webssh, :code_runinng_message, :vnc] before_filter :require_login, :except => [:training_task_status, :close_webssh, :code_runinng_message, :vnc] before_filter :check_authentication, :except => [:training_task_status, :close_webssh, :mul_test_home, :mul_test_user, - :mul_test_myshixun, :mul_test_shixun, :mul_test_start, :code_runinng_message] + :mul_test_myshixun, :mul_test_shixun, :mul_test_start, :code_runinng_message, :vnc] before_filter :find_myshixun, :only => [:show, :myshixun_reset, :open_webssh, :sync_reset_time, :destroy, :search_file_list, :vnc] DCODES = %W(2 3 4 5 6 7 8 9 a b c f e f g h i j k l m n o p q r s t u v w x y z) From 03843caf39c84e4c54befcfc5a242b1d9df0f14d Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Thu, 30 May 2019 10:17:55 +0800 Subject: [PATCH 31/32] 500 --- app/controllers/myshixuns_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb index e9f412ab..802bb8b9 100644 --- a/app/controllers/myshixuns_controller.rb +++ b/app/controllers/myshixuns_controller.rb @@ -357,7 +357,7 @@ class MyshixunsController < ApplicationController host = Redmine::Configuration['tomcat_php'] begin uri = "#{shixun_tomcat}/bridge/vnc/getvnc" - shixun = myshixun.shixun + shixun = @myshixun.shixun params = {tpiID: @myshixun.id, :containers => "#{Base64.urlsafe_encode64(container_limit(shixun.mirror_repositories))}"} res = uri_exec uri, params if res && res['code'].to_i != 0 From 89acf0b0cd991ace8fb8598a6c7ccce6746d5c1e Mon Sep 17 00:00:00 2001 From: p31729568 Date: Thu, 30 May 2019 10:51:39 +0800 Subject: [PATCH 32/32] modify school manager statistic text --- .../schools/_contrast_search_form.html.erb | 11 ++++------- .../managements/schools/_data_contrast_list.html.erb | 4 ++-- .../managements/schools/_data_grow_list.html.erb | 4 ++-- config/locales/school_daily_reports/zh.yml | 2 +- 4 files changed, 9 insertions(+), 12 deletions(-) diff --git a/app/views/managements/schools/_contrast_search_form.html.erb b/app/views/managements/schools/_contrast_search_form.html.erb index 4d24a810..9597a9c7 100644 --- a/app/views/managements/schools/_contrast_search_form.html.erb +++ b/app/views/managements/schools/_contrast_search_form.html.erb @@ -26,13 +26,10 @@
    <%= hidden_field_tag :data_type, params[:data_type] || 'grow' %> - <% if params[:data_type] == 'contrast' %> - 时间对比 - 新增数据 - <% else %> - 时间对比 - 新增数据 - <% end %> + 时段对比 + 数据变化
    <%= text_field_tag :keyword, params[:keyword], placeholder: '请输入单位名称或者ID关键字进行搜索', diff --git a/app/views/managements/schools/_data_contrast_list.html.erb b/app/views/managements/schools/_data_contrast_list.html.erb index d77d4b70..83f7a11b 100644 --- a/app/views/managements/schools/_data_contrast_list.html.erb +++ b/app/views/managements/schools/_data_contrast_list.html.erb @@ -21,8 +21,8 @@ 序号 ID 单位名称 - 时段一
    <%= "(#{params[:begin_date]}至#{params[:end_date]})" %> - 时段二
    <%= "(#{params[:other_begin_date]}至#{params[:other_end_date]})" %> + 时段一
    <%= "(#{params[:begin_date]} 05:00至#{params[:end_date]} 05:00)" %> + 时段二
    <%= "(#{params[:other_begin_date]} 05:00至#{params[:other_end_date]} 05:00)" %> <%= sort_tag('变化情况', name: 'percentage', path: school_data_contrast_managements_path) %>
    ( 新 增 数 | 新增百分比) diff --git a/app/views/managements/schools/_data_grow_list.html.erb b/app/views/managements/schools/_data_grow_list.html.erb index 27a1ccf3..8f502979 100644 --- a/app/views/managements/schools/_data_grow_list.html.erb +++ b/app/views/managements/schools/_data_grow_list.html.erb @@ -9,7 +9,7 @@ 新增教师<%= @grow_summary.teacher_increase_count || 0 %>人, 新增学生<%= @grow_summary.student_increase_count || 0 %>人, 新增课堂<%= @grow_summary.course_increase_count || 0 %>个, - 新增实训<%= @grow_summary.shixun_increase_count || 0 %>个, + 新增实训作业<%= @grow_summary.shixun_increase_count || 0 %>个, 活跃用户<%= @grow_summary.active_user_count || 0 %>
    @@ -22,7 +22,7 @@ - + diff --git a/config/locales/school_daily_reports/zh.yml b/config/locales/school_daily_reports/zh.yml index 57caf343..2db8a429 100644 --- a/config/locales/school_daily_reports/zh.yml +++ b/config/locales/school_daily_reports/zh.yml @@ -3,5 +3,5 @@ zh: teacher_increase_count: 新增教师 student_increase_count: 新增学生 course_increase_count: 新增课堂 - shixun_increase_count: 新增实训 + shixun_increase_count: 新增实训作业 active_user_count: 活跃用户 \ No newline at end of file
    <%= sort_tag('新增教师', name: 'teacher_increase_count', path: school_data_grow_managements_path) %> <%= sort_tag('新增学生', name: 'student_increase_count', path: school_data_grow_managements_path) %> <%= sort_tag('新增课堂', name: 'course_increase_count', path: school_data_grow_managements_path) %><%= sort_tag('新增实训', name: 'shixun_increase_count', path: school_data_grow_managements_path) %><%= sort_tag('新增实训作业', name: 'shixun_increase_count', path: school_data_grow_managements_path) %> <%= sort_tag('活跃用户', name: 'active_user_count', path: school_data_grow_managements_path) %>