diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index 93529f57c..4d9231287 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -334,7 +334,7 @@ class CoursesService if current_user.member_of_course?(course) #如果已经是成员 member = course.members.where("user_id=#{current_user.id} and course_id=#{course.id}")[0] roleName = member.roles[0].name if member - if params[:course_password] == course.password + if params[:course_password] == course.password || params[:invite_code].present? #如果加入角色为学生 并且当前是学生 if params[:role] == "10" && roleName == "Student" @state = 3 @@ -367,7 +367,7 @@ class CoursesService @state = 1 end else - if params[:course_password] == course.password + if params[:course_password] == course.password || params[:invite_code].present? if params[:role] == "10" || params[:role] == nil members = [] members << Member.new(:role_ids => [10], :user_id => current_user.id)