This commit is contained in:
guange 2016-06-22 17:02:33 +08:00
parent 40217d5c56
commit fc5895e74f
1 changed files with 2 additions and 2 deletions

View File

@ -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)