From de488b7b7eb5ff836f2fc5a3dc8a3b1a81af3abe Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 15 Nov 2019 16:38:18 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E5=A0=82=E6=B7=BB=E5=8A=A0=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E7=9B=B8=E5=85=B3=E7=9A=84=E6=95=B0=E6=8D=AE=E9=9A=94?= =?UTF-8?q?=E7=A6=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 5b9e07e84..98c70e0b4 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -467,7 +467,7 @@ class CoursesController < ApplicationController # user_ids_of_course_members = @course.course_members.where(role: [1,2,3]).pluck(:user_id) # @users = User.where.not(id: user_ids_of_course_members) - @users = User.where(status: User::STATUS_ACTIVE) + @users = User.where(status: User::STATUS_ACTIVE, laboratory_id: @course.laboratory_id) @users = @users.where("concat(users.lastname, users.firstname) like '%#{name}%'") if name.present? # REDO:Extension @users = @users.joins(user_extension: :school).where("schools.name like '%#{school_name}%'") if school_name.present? @@ -1083,7 +1083,7 @@ class CoursesController < ApplicationController school_name = params[:school_name] # REDO:Extension - @users = User.where(status: User::STATUS_ACTIVE) + @users = User.where(status: User::STATUS_ACTIVE, laboratory_id: @course.laboratory_id) @users = @users.where("concat(users.lastname, users.firstname) like '%#{name}%'") if name.present? # REDO:Extension @users = @users.joins(user_extension: :school).where("schools.name like '%#{school_name}%'") if school_name.present? @@ -1103,12 +1103,12 @@ class CoursesController < ApplicationController # 邀请码验证 return normal_status(-1, "邀请码不能为空") if params[:invite_code].blank? invite_code = params[:invite_code] - course = Course.find_by(invite_code: invite_code, is_delete: 0, invite_code_halt: 0) + course = Course.find_by(invite_code: invite_code, is_delete: 0, invite_code_halt: 0, laboratory_id: current_laboratory.id) course_group = CourseGroup.find_by(invite_code: invite_code) if course.blank? return normal_status(-1, "邀请码无效") if course_group.blank? - course = Course.find_by(id: course_group.course_id, is_delete: 0, invite_code_halt: 0) + course = Course.find_by(id: course_group.course_id, is_delete: 0, invite_code_halt: 0, laboratory_id: current_laboratory.id) return normal_status(-1, "邀请码无效") if course.blank? end