课程加入消息错误
This commit is contained in:
parent
35719f9c28
commit
b448e1a4c5
|
@ -308,15 +308,31 @@ class CoursesService
|
||||||
if course_endTime_timeout? course
|
if course_endTime_timeout? course
|
||||||
@state = 2
|
@state = 2
|
||||||
else
|
else
|
||||||
if current_user.member_of_course?(course)
|
if current_user.member_of_course?(course) #如果已经是成员
|
||||||
|
if params[:course_password] == course.password
|
||||||
|
#如果加入角色为学生
|
||||||
|
if params[:role] == "10"
|
||||||
@state = 3
|
@state = 3
|
||||||
|
else
|
||||||
|
#如果加入角色为教师或者教辅
|
||||||
|
CourseMessage.create(:user_id => course.tea_id, :course_id => course.id, :viewed => false,:content=> params[:role],:course_message_id=>User.current.id,:course_message_type=>'JoinCourseRequest',:status=>0)
|
||||||
|
@state = 6
|
||||||
|
end
|
||||||
|
else
|
||||||
|
@state = 1
|
||||||
|
end
|
||||||
else
|
else
|
||||||
if params[:course_password] == course.password
|
if params[:course_password] == course.password
|
||||||
|
if params[:role] == "10"
|
||||||
members = []
|
members = []
|
||||||
members << Member.new(:role_ids => [10], :user_id => current_user.id)
|
members << Member.new(:role_ids => [10], :user_id => current_user.id)
|
||||||
course.members << members
|
course.members << members
|
||||||
StudentsForCourse.create(:student_id => current_user.id, :course_id => params[:object_id])
|
StudentsForCourse.create(:student_id => current_user.id, :course_id => params[:object_id])
|
||||||
@state = 0
|
@state = 0
|
||||||
|
else
|
||||||
|
CourseMessage.create(:user_id => course.tea_id, :course_id => course.id, :viewed => false,:content=> params[:role],:course_message_id=>User.current.id,:course_message_type=>'JoinCourseRequest',:status=>0)
|
||||||
|
@state = 6
|
||||||
|
end
|
||||||
else
|
else
|
||||||
@state = 1
|
@state = 1
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue